为我的python项目创建setup.py,下载依赖包的问题

时间:2013-11-18 07:47:44

标签: python django packaging setuptools setup.py

这是我的setup.py文件

try:
   from setuptools import setup, find_packages
except ImportError:
   from ez_setup import use_setuptools
   use_setuptools()
   from setuptools import setup, find_packages

setup(
   name='test',
   version='0.1',
   description='',
   author='',
   author_email='',
   install_requires=[
      'django >= 1.2.3',
      'pyxmlsec',
      'south',
      'lxml',
      'xlrd'
   ],
   packages=find_packages(exclude=['ez_setup']),
   include_package_data=True,
   test_suite='nose.collector',
)

运行命令python setup.py install后,它会在.egg中安装site_packges,但在安装依赖项时会抛出错误:

 Processing dependencies for test==0.1
 Searching for lxml
 Reading https://pypi.python.org/simple/lxml/
 Download error on https://pypi.python.org/simple/lxml/: timed out -- Some packages may not be found!
 Couldn't find index page for 'lxml' (maybe misspelled?)
 Scanning index of all packages (this may take a while)
 Reading https://pypi.python.org/simple/
 Download error on https://pypi.python.org/simple/: timed out -- Some packages may not be found!
 No local packages or download links found for lxml
 error: Could not find suitable distribution for Requirement.parse('lxml')

不仅lxml模块,所有其他模块(如xlrd)也会发生同样的错误。源代码尝试pypi链接没问题。那么解决方案是什么呢?提前致谢。

1 个答案:

答案 0 :(得分:1)

许多用户报告了pypi down的问题,也许你通过使用mirror来解决,或者因为你有很多客户端(我想在同一个网络/组织中),local pypi server应该是一个不错的解决方案,这是我已经完成的pypi alternatives列表。