windows 上的 Pipenv 安装 wrapt 时出错(python 3.6.8)

Pipenv on windows failing with error installing wrapt (python 3.6.8)

我正在开始一个新的 python 项目,当我尝试安装我的虚拟环境时,我总是遇到 wrapt 的失败。几天来,我已经阅读并尝试了在这里和其他论坛上可以找到的所有解决方案,但没有成功。

你能想到再试一次会有什么问题吗?这很奇怪,因为同一个项目和代码在其他类似的 Windows 机器上工作...

D:\git_project>python --version
Python 3.6.8

D:\git_project>pip --version
pip 19.3.1 from c:\python36\lib\site-packages\pip (python 3.6)

D:\git_project>pipenv --version
pipenv, version 2018.11.27.dev0

D:\git_project>python -m pipenv install
Creating a virtualenv for this project…
Pipfile: D:\git_project\Pipfile
Using C:/Python36/python.exe (3.6.8) to create virtualenv…
[=== ] Creating virtual environment...Already using interpreter C:\Python36\python.exe
Using base prefix 'C:\Python36'
New python executable in C:\Users\admin\.virtualenvs\git_project-UBvgpj5x\Scripts\python.exe
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter C:/Python36/python.exe

Successfully created virtual environment!
Virtualenv location: C:\Users\admin\.virtualenvs\git_project-UBvgpj5x
Installing dependencies from Pipfile.lock (1e32a5)…
An error occurred while installing wrapt==1.11.2 --hash=sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1! Will try again.
  ================================ 84/84 - 00:02:14
Installing initially failed dependencies…
[InstallError]:   File "C:\Python36\lib\site-packages\pipenv\cli\command.py", line 251, in install
[InstallError]:       site_packages=state.site_packages
...
...
[pipenv.exceptions.InstallError]:       File "c:\users\admin\.virtualenvs\git_project-ubvgpj5x\lib\genericpath.py", line 30, in isfile
[pipenv.exceptions.InstallError]:         st = os.stat(path)
[pipenv.exceptions.InstallError]:     TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
[pipenv.exceptions.InstallError]:     ----------------------------------------
[pipenv.exceptions.InstallError]: ERROR: Command errored out with exit status 1:

这是对完整输出的 link,以防您找到有用的东西来尝试弄清楚发生了什么? https://pastebin.com/raw/8gdUUZN8

谢谢!!

修复了在 运行 之前设置以下变量:pipenv --three install

set WRAPT_INSTALL_EXTENSIONS=false

我得到了相同的堆栈跟踪,我的问题是我的机器上没有安装最新的 Microsoft Visual C++ Redistributable。这有点傻,但安装脚本只是查找 dll 并在不存在时出现此错误,而不是先检查它并显示有意义的错误消息...

堆栈跟踪的重要部分:

[pipenv.exceptions.InstallError]:     File "c:\users\admin\.virtualenvs\git_project-ubvgpj5x\lib\site-packages\setuptools\msvc.py", line 171, in msvc14_get_vc_env
[pipenv.exceptions.InstallError]:       return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
[pipenv.exceptions.InstallError]:     File "c:\users\admin\.virtualenvs\git_project-ubvgpj5x\lib\site-packages\setuptools\msvc.py", line 1620, in return_env
[pipenv.exceptions.InstallError]:       if self.vs_ver >= 14 and isfile(self.VCRuntimeRedist):
[pipenv.exceptions.InstallError]:     File "c:\users\admin\.virtualenvs\git_project-ubvgpj5x\lib\genericpath.py", line 30, in isfile
[pipenv.exceptions.InstallError]:       st = os.stat(path)
[pipenv.exceptions.InstallError]:   TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType
[pipenv.exceptions.InstallError]:   ----------------------------------------
如果未安装 C++ Redistributable,

self.VCRuntimeRedist 将 return None,这将在使用 None 调用 isfile 时导致此错误。