简体   繁体   English

如何修复 Python 3.5 的 pip 不在 Windows x64 上编译扩展

[英]How to fix pip for Python 3.5 not compiling extensions on Windows x64

There are many questions on here about problems with pip installing Python extensions which require C++ compilation.关于 pip 安装需要 C++ 编译的 Python 扩展的问题,这里有很多问题。 However many of these solutions are out of data as of Python 3.5.但是,从 Python 3.5 开始,这些解决方案中的许多解决方案都没有数据了。

Mostly these problems revolve around the missing vcvarsall.bat problem that comes with not installing Microsoft Visual Studio or not installing the right version.大多数情况下,这些问题都围绕着未安装 Microsoft Visual Studio 或未安装正确版本而导致的 vcvarsall.bat 丢失问题。

Having dealt with this issue I am now faced with a value error when I try to install these module through pip.处理完这个问题后,当我尝试通过 pip 安装这些模块时,我现在面临一个值错误。

Can anyone provide a canonical method to get a fresh install of Python 3.5 x64 on a fresh install of Windows (Windows 7 x64 in my case) to be able to correctly install modules through pip that require compilation?任何人都可以提供一种规范的方法来在全新安装的 Windows(在我的情况下为 Windows 7 x64)上全新安装 Python 3.5 x64,以便能够通过需要编译的 pip 正确安装模块?

For reference here is the error I am currently getting while attempting to install matplotlib (note the error is being caused by pip attempting to update numpy as it is required by matplotlib)作为参考,这是我目前在尝试安装 matplotlib 时遇到的错误(注意该错误是由 pip 尝试更新 numpy 引起的,因为它是 matplotlib 所要求的)

  vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python34\lib\site-packages\setuptools\msvc9_support.py", line 52,
in query_vcvarsall
    return unpatched['query_vcvarsall'](version, *args, **kwargs)
  File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
    raise ValueError(str(list(result.keys())))
ValueError: ['path']

For 3.5 you need Visual C++ 14.0. 对于3.5,您需要Visual C ++ 14.0。

Download the Community edition . 下载社区版

cl.exe will be in: cl.exe将在:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

Installing NumPy and matplotlib with precompiled .whl binaries would avoid this problem entirely. 使用预编译的.whl二进制文件安装NumPy和matplotlib可以完全避免这个问题。

download: numpy-1.10.1+mkl-cp35-none-win_amd64.whl 下载: numpy-1.10.1 + mkl-cp35-none-win_amd64.whl
from: lfd.uci.edu/~gohlke/pythonlibs/#numpy 来自: lfd.uci.edu/~gohlke/pythonlibs/#numpy

and

download: matplotlib-1.5.0rc3-cp35-none-win_amd64.whl 下载: matplotlib-1.5.0rc3-cp35-none-win_amd64.whl
from lfd.uci.edu/~gohlke/pythonlibs/#matplotlib 来自lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

Installation: 安装:

python -m pip install numpy-1.10.1+mkl-cp35-none-win_amd64.whl

python -m pip install matplotlib-1.5.0rc3-cp35-none-win_amd64.whl

another thing I just discovered is that you can do我刚刚发现的另一件事是你可以做

pip install --only-binary matplotlib

this will avoid having to install 4GB+ of C++ Build Tools or requiring admin rights, and I think it fetches the latest binary available for matplotlib这将避免必须安装 4GB+ 的 C++ 构建工具或需要管理员权限,我认为它会获取可用于 matplotlib 的最新二进制文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM