【发布时间】:2020-10-14 12:08:28
【问题描述】:
我们正在尝试安装以下轮子文件
ls /tmp/test
argparse-1.4.0-py2.py3-none-any.whl
一个选项是:
pip install --no-index --find-links=file:///tmp/test argparse-1.4.0-py2.py3-none-any.whl
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. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Requirement 'argparse-1.4.0-py2.py3-none-any.whl' looks like a filename, but the file does not exist
Looking in links: file:///tmp/test
Processing ./argparse-1.4.0-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/argparse-1.4.0-py2.py3-none-any.whl'
第二个选项是:
pip install --no-index --find-links=/tmp/test argparse-1.4.0-py2.py3-none-any.whl
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. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: Requirement 'argparse-1.4.0-py2.py3-none-any.whl' looks like a filename, but the file does not exist
Looking in links: /tmp/test
Processing ./argparse-1.4.0-py2.py3-none-any.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/tmp/argparse-1.4.0-py2.py3-none-any.whl'
在两个选项上 pip 都找不到 .whl 文件
有趣的是 pip 忽略了文件夹/tmp/test
这是怎么回事? ,为什么pip不能安装wheel文件并在/tmp/test文件夹下找到呢?
参考:
【问题讨论】:
-
这能回答你的问题吗? Wheel file installation
-
要么 1. 您将完整路径传递给 wheel 文件或 2. 您提供
--no-index,--find-links带有包含 wheel 的目录的路径,以及 wheel 中包含的项目的名称(不是 wheel 的文件名)。 -
只是一个小问题 - 我们可以使用选项 pip install --no-index --find-links=file:///tmp/test argparse --force-reinstall 或 pip install --no -index --find-links=file:///tmp/test argparse --ignore-installed
-
不完全确定,所以您应该自己尝试。我的假设是,如果(案例 1.)您明确提供轮文件的完整路径,那么无论已经安装了什么,它都会被安装。但是如果(情况 2.)您提供项目名称(
SomePackage,或带有索引和链接选项的argparse),那么您可能必须提供选项--ignore-installed和/或--force-reinstall也是。
标签: python python-2.7 pip rhel python-wheel