2012-09-09 80 views
1

我在openshift上運行python平臺上的BeautifulSoup。我試圖設置BeautifulSoup>=4.0setup.py文件中的「install_requires」部分,但它不能搜索BeautifulSoup 4,而是安裝BeautifulSoup 3.2.1,但對於我的項目我需要安裝BeautifulSoup >= 4.0。那麼如何獲得最新的安裝包BeautifulSoup如何在Openshift上安裝BeautifulSoup 4?

這是我的setup.py`文件的外觀。

#!/usr/bin/env python 

from setuptools import setup 

setup(
    name='YourAppName', 
    version='1.0', 
    description='OpenShift App', 
    author='Your Name', 
    author_email='[email protected]', 
    url='http://www.python.org/sigs/distutils-sig/', 
    install_requires=['Django>=1.3', 'BeautifulSoup>=4.0', 'robotexclusionrulesparser',], 
) 

以下是錯誤的樣子:

remote: Installed /var/lib/stickshift/1b1a7d93656c4782a58fab6c6df2d226/python-2.6/virtenv 
remote: Processing dependencies for YourAppName==1.0 
remote: Searching for BeautifulSoup>=4.0 
remote: Reading http://pypi.python.org/simple/BeautifulSoup/ 
remote: Reading http://www.crummy.com/software/BeautifulSoup/ 
remote: Reading http://www.crummy.com/software/BeautifulSoup/download/ 
remote: Reading http://www.crummy.com/software/BeautifulSoup/bs3/ 
remote: Reading http://www.crummy.com/software/BeautifulSoup/bs3/download/ 
remote: No local packages or download links found for BeautifulSoup>=4.0 
remote: Best match: None 
remote: Traceback (most recent call last): 
remote: File "/var/lib/stickshift/1b1a7d93656c4782a58fab6c6df2d226/app-root/runtime/repo/setup.py", line 12, in <module> 
remote:  install_requires=['Django>=1.3', 'BeautifulSoup>=4.0', 'robotexclusionrulesparser',], 
remote: File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup 
remote:  dist.run_commands() 
remote: File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands 
remote:  self.run_command(cmd) 
remote: File "/usr/lib64/python2.6/distutils/dist.py", line 995, in run_command 
remote:  cmd_obj.run() 
remote: File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 27, in run 
remote: File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 102, in install_for_development 
remote: File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 519, in process_distribution 
remote:  
remote: File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve 
remote:  distributions, errors = working_set.find_plugins(
remote: File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match 
remote:  
remote: File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain 
remote:  raise TypeError("Can't add %r to environment" % (other,)) 
remote: File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 434, in easy_install 
remote:  
remote: File "build/bdist.linux-i686/egg/setuptools/package_index.py", line 475, in fetch_distribution 
remote: AttributeError: 'NoneType' object has no attribute 'clone' 

任何幫助嗎?

回答

3

根據上游項目的文檔顯然版本4.x需要通過不同的命名約定爲pip安裝引用。

http://www.crummy.com/software/BeautifulSoup/#Download

我設置一個演示應用程序測試和設置我的setup.py包含以下內容:

從setuptools的導入設置

setup(name='YourAppName', 
     version='1.0', 
     description='OpenShift App', 
     author='Your Name', 
     author_email='[email protected]', 
     url='http://www.python.org/sigs/distutils-sig/', 
     install_requires=['Django>=1.3','beautifulsoup4'], 
    ) 

然後,git的承諾,並推動導致以下片段。

remote: Searching for beautifulsoup4 
remote: Reading http://pypi.python.org/simple/beautifulsoup4/remote: Reading http://www.crummy.com/software/BeautifulSoup/bs4/ 
remote: Reading http://www.crummy.com/software/BeautifulSoup/bs4/download/ 
remote: Best match: beautifulsoup4 4.1.3 
remote: Downloading http://www.crummy.com/software/BeautifulSoup/bs4/download/beautifulsoup4-4.1.3.tar.gz 
remote: Processing beautifulsoup4-4.1.3.tar.gz 
remote: Running beautifulsoup4-4.1.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-JgA5HZ/beautifulsoup4-4.1.3/egg-dist-tmp-1vIJ2i