我做了一个pip包并上传到这里:
https://pypi.org/project/audacityDiscogsExporter/0.1.0/
如果我运行pip install audacityDiscogsExporter==0.1.0
或pip install audacityDiscogsExporter
,我会收到一条错误消息:
martin@MSI:/mnt/c/Users/marti/Documents/projects/package$ pip install audacityDiscogsExporter
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement audacityDiscogsExporter (from versions: none)
ERROR: No matching distribution found for audacityDiscogsExporter
为什么我无法安装此软件包?
看起来您正在尝试使用 Python 2 解释器来安装仅限 Python-3 的项目。
当直接使用pip
(或实际上任何其他Python脚本(时,确保使用哪个Python解释器非常重要。通常调用pip
时使用哪个Python解释器是显而易见的,但也经常发生不清楚的情况。最好始终显式调用确切的 Python 解释器。通常:
$ python -m pip install Something
$ # instead of 'pip install Something'
$ python3 -m pip install Something
$ # instead of 'pip3 install Something'
如果仍然存在疑问,甚至可以更进一步,明确使用 Python 解释器的完整路径:
$ /usr/bin/python3.8 -m pip install Something
$ /path/to/myvenv/bin/python3 -m pip install Something
关于该主题的有趣阅读:Brett Cannon的文章"为什么你应该使用python -m pip
">