Pip install from pypi works, but from testpypi fails (cannot find requirements) (2个答案)
7个月前关闭。
当我将python软件包推送到test.pypi.org时,无法在不同的计算机和不同的虚拟环境上安装该软件包。我收到错误消息,说我的软件包的依赖项没有发行版,并且错误消息指出找不到满足要求的版本。
我尝试解析setup.py文件中的requirements.txt文件,然后运行
python setup.py sdist bdist_wheel
和
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
进行构建并将其上传到test.pipy.org,但问题仍然存在。
我的setup.py看起来像这样
...
dependencies=''
with open("requirements.txt","r") as f:
dependencies = f.read().splitlines()
setup(
name="FlagWaver",
version="0.0.54",
description=DESCRIPTION,
long_description = LONG_DESCRIPTION,
long_description_content_type = "text/markdown",
url="https://github.com/ShahriyarShawon/flag-wave",
author="Shahriyar Shawon",
author_email="ShahriyarShawon321@gmail.com",
license="Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International",
packages = [
"FlagWaver"
],
classifiers = [
"Programming Language :: Python :: 3"
],
install_requires = dependencies
)
然后我运行此bash脚本来构建和上传
#!/bin/zsh
pipenv shell
python setup.py sdist bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
我的requirements.txt看起来像这样
bleach==3.1.0
certifi==2019.6.16
chardet==3.0.4
cycler==0.10.0
docutils==0.15.2
idna==2.8
imageio==2.5.0
kiwisolver==1.1.0
matplotlib==3.1.1
numpy==1.17.0
opencv-python==4.1.0.25
pandas==0.25.0
Pillow==6.1.0
pkginfo==1.5.0.1
Pygments==2.4.2
pyparsing==2.4.2
python-dateutil==2.8.0
pytz==2019.2
readme-renderer==24.0
requests==2.22.0
requests-toolbelt==0.9.1
six==1.12.0
tqdm==4.32.2
twine==1.13.0
urllib3==1.25.3
webencodings==0.5.1
以及每个我都尝试运行
pip install -i https://test.pypi.org/simple/ FlagWaver
(这是test.pypi告诉我安装我的软件包的方式)
似乎总是选择另一种依赖项来提示
我希望能够成功安装我的软件包,其中包含所有requirements.txt文件中列出的依赖项,同时还能够成功创建pipfile.lock文件。相反,我收到类似的错误消息
ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.0.25 (from FlagWaver) (from versions: none)
ERROR: No matching distribution found for opencv-python==4.1.0.25 (from FlagWaver)
注意: opencv-python可以替换为requiremnets.txt文件中列出的几乎所有其他依赖项