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



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

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

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:UserskgreenSourceReposMapToolspy368_modules>pip install --no-index "PyInstaller-3.6.tar.gz"
Processing c:userskgreensourcereposmaptoolspy368_modulespyinstaller-3.6.tar.gz
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'c:userskgreensourcereposmaptoolspy368scriptspython.exe' 'c:userskgreensourcereposmaptoolspy368libsite-packagespip' install --ignore-installed --no-user --prefix 'C:UserskgreenAppDataLocalTemppip-build-env-fcj_djosoverlay' --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:userskgreensourcereposmaptoolspy368scriptspython.exe' 'c:userskgreensourcereposmaptoolspy368libsite-packagespip' install --ignore-installed --no-user --prefix 'C:UserskgreenAppDataLocalTemppip-build-env-fcj_djosoverlay' --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,当它不起作用时,我尝试回到错误消息中提到的确切版本。

注意:当我稍后尝试安装西班牙凉菜时,我也会遇到同样的错误。。。无法识别setuptools>40.8.0已安装。

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

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

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

我在尝试安装atlassian-python-api时遇到了同样的问题。如果尝试脱机安装程序包(带有--no-index标志(,则看起来pip(来自版本10(有问题。我在PyInstaller github上找到了解决方案:https://github.com/pyinstaller/pyinstaller/issues/4557#issuecomment-569450071("PEP517建议包构建应该在一个隔离的环境中完成,pip通过使用--ignore installed"来完成(

所以只需在pip命令中添加--no-build-isolation标志:

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

也许您还需要安装wheel软件包。请在此处查看详细信息:为什么python setup.py说无效命令';bdist_wheel';Travis CI?

你能用&quot--查找链接"?

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

这意味着从pypi安装本地软件包和其他所需的软件包。如果您pip安装一个";setuptools-40.8.0";成功,是你的错。但由于忽略了安装setuptools,可能有些软件包已损坏。

最新更新