我正在为一个私人项目编写setup.py
安装文件,其中包含公共和私有依赖项。公共的依赖项托管在PyPI上,而私有的依赖项则托管在运行simplepypi的服务器上。
我希望在安装期间能够解决并获取两种类型的依赖项。
因此,我将我的依赖项添加到了setup.py
中:
setup(
...
install_requires = [
# public dependencies
'argparse==1.2.1',
'beautifulsoup4==4.1.3',
'lxml==3.1.0',
'mongoengine==0.8.2',
'pymongo==2.5.2',
'requests==1.1.0',
'Cython==0.18',
# private dependencies
'myprivatepackage1',
'myprivatepackage2'
],
dependency_links=['http://pypi.myserver.com/packages'],
...
)
我使用命令 python setup.py sdist
构建软件包tarball,然后使用 pip install --verbose path/to/tarball.tar.gz
在已激活的虚拟环境中安装它。
然而,pip日志中没有提到我的私有PyPI服务器,https://pypi.python.org/simple/似乎被查询了两次。
Running setup.py egg_info for package from file:///home/b/code/mapado/mypackage/dist/mypackage-0.5.1.tar.gz
running egg_info
creating pip-egg-info/mypackage.egg-info
writing requirements to pip-egg-info/mypackage.egg-info/requires.txt
writing pip-egg-info/mypackage.egg-info/PKG-INFO
writing top-level names to pip-egg-info/mypackage.egg-info/top_level.txt
writing dependency_links to pip-egg-info/mypackage.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/mypackage.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
reading manifest file 'pip-egg-info/mypackage.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pip-egg-info/mypackage.egg-info/SOURCES.txt'
Downloading/unpacking myprivatepackage (from mypackage==0.5.1)
Could not fetch URL https://pypi.python.org/simple/myprivatepackage/: HTTP Error 404: Not Found (myprivatepackage does not have any releases)
Will skip URL https://pypi.python.org/simple/myprivatepackage/ when looking for download links for myprivatepackage (from mypackage==0.5.1)
Could not fetch URL https://pypi.python.org/simple/myprivatepackage/: HTTP Error 404: Not Found (myprivatepackage does not have any releases)
Will skip URL https://pypi.python.org/simple/myprivatepackage/ when looking for download links for myprivatepackage (from mypackage==0.5.1)
Could not find any downloads that satisfy the requirement myprivatepackage (from mypackage==0.5.1)
Cleaning up...
我错过了什么?
~/.pypirc
的情况下完成这个操作?也就是说,只通过setup.py
纯粹地完成它? - Thomas Rublesetup.py
,所以被投下了反对票。修改~/.pypirc
对我来说不是一个选择。 - bfontaine