pip安装无法识别之前安装的包

3
我希望为一个项目创建一个标准的虚拟环境。我已经有了一个包含所有必需模块的工作虚拟环境。我有一个批处理文件来安装所需的内容。
批处理代码的一部分如下:
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"

当我运行这个程序时,出现了以下错误:
(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 list时,我看到确实已经安装了正确版本的setuptools。
(编辑)注意:我忘了提到这也必须适用于未连接到互联网的系统,因此解决方案必须指向wheel文件或zip文件,而不是直接指向PyPi。
我还尝试手动输入安装程序,想着可能需要延迟完成对先前安装setuptools的处理。 (也许很傻,但我绝望了。) 为什么它看不到那个版本?我该如何解决这个问题?
2个回答

2
当我尝试安装atlassian-python-api时,我遇到了同样的问题。看起来这是pip(从版本10开始)的问题,如果尝试离线安装软件包(使用--no-index标志)。我在PyInstaller github上找到了解决方案:https://github.com/pyinstaller/pyinstaller/issues/4557#issuecomment-569450071(“PEP517建议使用孤立环境进行软件包构建,pip使用--ignore-installed实现”)。
因此,只需将--no-build-isolation标志添加到pip命令中即可:
pip install --no-index --find-links "PyInstaller-3.6.tar.gz" --no-build-isolation

也许您还需要安装wheel包。详情请见此处:为什么Travis CI上Python setup.py会提示无效命令'bdist_wheel'?

1

你可以尝试使用“--find-links”参数吗?

pip install --no-index --find-links "PyInstaller-3.6.tar.gz"

这意味着安装本地软件包并从pypi安装其他所需的软件包。如果您pip安装“setuptools-40.8.0”成功,则是您的问题。但是,如果忽略安装setuptools,则可能会导致某些软件包损坏。

我会尽力找到链接。由于这个系统也必须适用于没有连接到互联网的系统,所以我特别需要安装whl或zip文件。这是我的错,我在问题定义中忘记了提及这一点。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接