如何修复找不到满足需求的版本'对于install_requires列表,在自定义软件包中安装PIP时?
我正在尝试使用Twine软件包构建自己的Python软件包(可通过PIP安装)。一切都很好,直到我尝试安装实际包装(因此上传到PYPI之后)。
因此,我首先运行:
python3 setup.py sdist bdist_whreel
,
其中我的设置.py.py install_requires
list看起来像这样:
install_requires=[
'jupyter_kernel_gateway==2.4.0',
'pandas==1.0.2',
'numpy==1.18.1',
'azure-storage-blob==2.0.1',
'azure-datalake-store==0.0.48',
'psycopg2-binary==2.8.4',
'xlsxwriter==1.2.6',
'SQLAlchemy==1.3.12',
'geoalchemy2==0.6.3',
'tabulate==0.8.2',
'pyproj==1.9.6',
'geopandas==0.4.0',
'contextily==0.99.0',
'matplotlib==3.0.2',
'humanize==0.5.1',
'ujson==1.35',
'singleton-decorator==1.0.0',
'dataclasses==0.6',
'xlrd==1.2.0'],
在我的理解中,这些install_requires将在pip安装时安装时我自己的包裹。
此后,我运行
Python3 -M Twine上传-repository testpypi dist/*
实际上将我的软件包上传到PYPI。但是,当PIP安装我的软件包时,我会遇到错误,说没有任何版本满足许多列出要求的要求。例如:错误:找不到满足需求psycopg2-binary == 2.8.4
的版本
(例如,我手动安装这些软件包时/code>),它们确实安装了。
是否有任何方法可以使我的软件包的PIP安装实际上安装install_requires
要求列表成功?
I am trying to build my own Python package (installable by pip) using the twine package. This is all going well right up until the point where I try to pip install my actual package (so after uploading to PyPi).
So I first run:
python3 setup.py sdist bdist_wheel
In which my setup.py install_requires
list looks like this:
install_requires=[
'jupyter_kernel_gateway==2.4.0',
'pandas==1.0.2',
'numpy==1.18.1',
'azure-storage-blob==2.0.1',
'azure-datalake-store==0.0.48',
'psycopg2-binary==2.8.4',
'xlsxwriter==1.2.6',
'SQLAlchemy==1.3.12',
'geoalchemy2==0.6.3',
'tabulate==0.8.2',
'pyproj==1.9.6',
'geopandas==0.4.0',
'contextily==0.99.0',
'matplotlib==3.0.2',
'humanize==0.5.1',
'ujson==1.35',
'singleton-decorator==1.0.0',
'dataclasses==0.6',
'xlrd==1.2.0'],
In my understanding, these install_requires would be installed by pip when installing my own package.
After this I run
python3 -m twine upload --repository testpypi dist/*
To actually upload my package to PyPi. However, when pip installing my package, I get errors that say there are no versions that satisfy the requirements for a lot of the listed requirements. E.g.: ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.4
When I manually install these packages (e.g. pip install psycopg2-binary==2.8.4
), they do get installed.
Is there any way to make the pip install of my package actually install the install_requires
requirement list succesfully?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有说明
pip install
- ing your软件包,但我猜您正在使用类似的内容:问题是TestPypi不包含PYPI上存在的依赖项的副本。例如:
/stable/reference/pip_install/#install-extra-index-url“ rel =“ noreferrer”>
- 额外index-url
而不是:You didn't show how your
pip install
-ing your package, but I'm guessing you're using something like:The issue is that TestPyPI doesn't contain copies of your dependencies that exist on PyPI. For example:
You can configure pip to fall back on TestPyPI when a package is missing instead by specifying
--extra-index-url
instead: