首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pip安装无法识别以前安装的软件包

pip安装无法识别以前安装的软件包
EN

Stack Overflow用户
提问于 2021-01-14 10:24:48
回答 2查看 222关注 0票数 1

我正在尝试为一个项目创建一个标准的虚拟环境。我有一个工作的虚拟环境与所有需要的模块。我有一个批处理文件来安装所需的东西。

批处理代码的一部分如下所示:

代码语言:javascript
复制
pip install --no-index "altgraph-0.17-py2.py3-none-any.whl"
pip install --no-index "pefile-2017.8.1.zip"
pip install --no-index "pywin32_ctypes-0.2.0-py2.py3-none-any.whl"

pip install --no-index "setuptools-40.8.0-py2.py3-none-any.whl "
pip install --no-index "PyInstaller-3.6.tar.gz"

当我运行此命令时,我得到以下错误:

代码语言:javascript
复制
(py368) C:\Users\kgreen\Source\Repos\MapTools\py368_modules>pip install --no-index "PyInstaller-3.6.tar.gz"
Processing c:\users\kgreen\source\repos\maptools\py368_modules\pyinstaller-3.6.tar.gz
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\kgreen\source\repos\maptools\py368\scripts\python.exe' 'c:\users\kgreen\source\repos\maptools\py368\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\kgreen\AppData\Local\Temp\pip-build-env-fcj_djos\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=40.8.0' wheel
       cwd: None
  Complete output (2 lines):
  ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0
  ERROR: No matching distribution found for setuptools>=40.8.0
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\kgreen\source\repos\maptools\py368\scripts\python.exe' 'c:\users\kgreen\source\repos\maptools\py368\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\kgreen\AppData\Local\Temp\pip-build-env-fcj_djos\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: --no-index -- 'setuptools>=40.8.0' wheel Check the logs for full command output.

但这正是我安装的setuptools版本!我之前尝试过setuptools-41.4.0,当它不起作用时,我尝试返回到错误消息提到的确切版本。

注意:当我稍后尝试安装gazpacho时,我得到了同样的错误...无法识别setuptools>=40.8.0已安装。

注意:当我执行pip列表时,我看到setuptools的正确版本确实已经安装。

(编辑)注:我忘了提到,这也必须适用于未连接到互联网的系统,因此解决方案必须指向滚轮文件或zips,而不是直接指向PyPi。

我还尝试在安装完成后手动输入安装,认为可能需要延迟完成对先前安装的setuptools的一些处理。(也许很傻,但我已经绝望了。)为什么它看不到那个版本?我该如何解决这个问题呢?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-10-27 07:50:46

我在尝试安装atlassian-python-api时也遇到了同样的问题。如果尝试脱机安装包(带有--no-index标志),则可能是pip (从版本10开始)有问题。我在PyInstaller github上找到了解决方案:https://github.com/pyinstaller/pyinstaller/issues/4557#issuecomment-569450071 ("PEP517建议应该在一个隔离的环境中构建包,就像pip使用--ignore-installed所做的那样“)

因此,只需将--no-build-isolation标志添加到pip命令:

代码语言:javascript
复制
pip install --no-index --find-links "PyInstaller-3.6.tar.gz" --no-build-isolation

也许你还需要安装wheel包。详情请看这里:Why is python setup.py saying invalid command 'bdist_wheel' on Travis CI?

票数 1
EN

Stack Overflow用户

发布于 2021-01-14 10:43:13

你能试试"--find-links“吗?

代码语言:javascript
复制
pip install --no-index --find-links "PyInstaller-3.6.tar.gz"

这意味着安装本地软件包,并从pypi安装其他所需的软件包。如果您pip安装"setuptools-40.8.0“成功,则是您的错误。但是由于忽略了setuptools的安装,可能一些包被破坏了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65712539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档