【问题标题】:pip install + pip cant instelled the weel file from a local flat directorypip install + pip 无法从本地平面目录安装轮文件
【发布时间】: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


【解决方案1】:

您可能需要使用包名称而不是轮子的文件名。试试

pip install --no-index --find-links=file:///tmp/test/ argparse

但是,installing the wheel directly should work:

pip install /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。什么?文件的完整路径?
  • 因为您使用的是 --find_links ,它做了一些非常具体的事情。试试我给的第二个选项。
  • 如何检查是否安装了 - Wheel 库:?
  • 此类问题请使用 Google。 askubuntu.com/questions/588390/…
  • 我们可以使用选项 pip install --no-index --find-links=file:///tmp/test argparse --force-reinstall OR pip install --no-index -- find-links=file:///tmp/test argparse --ignore-installed
猜你喜欢
  • 2021-10-31
  • 2018-09-23
  • 2016-06-30
  • 2019-01-12
  • 2015-12-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多