Python 3.x 如何修复';找不到满足要求的版本';在自定义软件包中安装pip时,是否需要安装清单?

Python 3.x 如何修复';找不到满足要求的版本';在自定义软件包中安装pip时,是否需要安装清单?,python-3.x,pip,setup.py,pypi,twine,Python 3.x,Pip,Setup.py,Pypi,Twine,我正在尝试使用twine包构建自己的Python包(可由pip安装)。在我尝试pip安装我的实际软件包之前(所以在上传到PyPi之后),一切都进展顺利 因此,我首先运行: python3 setup.py sdist bdist\u wheel 其中my setup.pyinstall\u requires列表如下所示: install_requires=[ 'jupyter_kernel_gateway==2.4.0', 'pandas==1.0.2', 'numpy==1.18.1', 'a

我正在尝试使用twine包构建自己的Python包(可由pip安装)。在我尝试pip安装我的实际软件包之前(所以在上传到PyPi之后),一切都进展顺利

因此,我首先运行:

python3 setup.py sdist bdist\u wheel

其中my setup.py
install\u requires
列表如下所示:

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'],
据我所知,这些安装要求将由pip在安装我自己的软件包时安装

这之后我就跑了

python3-m绳线上传——存储库testpypi dist/*

将我的包上传到PyPi。然而,当pip安装我的软件包时,我会遇到错误,即没有满足许多列出的需求的版本。例如:
错误:找不到满足要求的版本psycopg2 binary==2.8.4

当我手动安装这些软件包时(例如,
pip-install-psycopg2-binary==2.8.4
),它们会被安装


有没有办法让我的软件包的pip安装真正成功地安装
install\u requires
需求列表?

你没有展示你的
pip安装是如何安装你的软件包的,但我猜你使用的是类似于:

pip install your_project --index-url https://test.pypi.org/simple
问题是TestPyPI不包含存在于PyPI上的依赖项的副本。例如:

  • 存在:
  • 不存在:
您可以通过指定以下内容,将pip配置为在缺少包时使用TestPyPI:


按照以下步骤操作
https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56
谢谢。在我应该使用的地方使用了索引url,这让我大吃一惊——额外的索引url。
pip install your_project --extra-index-url https://test.pypi.org/simple