【发布时间】:2021-01-09 20:15:34
【问题描述】:
我正在尝试使用 twine 包构建我自己的 Python 包(可通过 pip 安装)。这一切都很顺利,直到我尝试 pip 安装我的实际包(所以在上传到 PyPi 之后)。
所以我先运行:
python3 setup.py sdist bdist_wheel
其中我的 setup.py install_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'],
据我了解,这些 install_requires 将在安装我自己的包时由 pip 安装。
在此之后我运行
python3 -m twine upload --repository testpypi dist/*
真正将我的包上传到 PyPi。但是,当 pip 安装我的包时,我收到错误说没有满足许多列出的要求的版本。例如:ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.4
当我手动安装这些包(例如pip install psycopg2-binary==2.8.4)时,它们会被安装。
有什么方法可以让我的包的 pip install 实际成功安装install_requires 需求列表?
【问题讨论】:
-
按照这个步骤
https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56
标签: python-3.x pip setup.py pypi twine