vcvarsall.bat 需要 python 来编译 visual studio 2015 中缺失的(v 14)
vcvarsall.bat needed for python to compile missing from visual studio 2015 ( v 14)
我正在尝试在 python 3.5 中安装 numpy windows 10 并安装了 visual studio 2015 ultimate。
简短版本:vs14 文件夹 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
文件夹中缺少文件 vcvarsall.bat
。为什么?
长版:
运行 pip install numpy
给我这个错误 error: Unable to find vcvarsall.bat
研究这个错误让我得到了几个 Whosebug 的答案,这些答案帮助我弄清楚 python 需要 c++ 编译器来编译一些包。它需要使用与编译 python 3.5 (
error: Unable to find vcvarsall.bat)。我的 python 是使用 [MSC v.1900 64 位 (AMD64)] 编译的 - 这是 vs 14 ( visual studio 2015 )
通过进一步研究,我了解到:
pip install gives error: Unable to find vcvarsall.bat那个
get_build_version()
来自 $python_install_prefix/Lib/distutils/msvc9compiler.py
returns 应该用来查找 vcvarsall.bat
路径的 vs 版本
对我来说这个方法returns 14。所以一切正确。
现在,当我查看文件夹 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
时,发现缺少文件 vcvarsall.bat。
但是当我查看文件夹 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
时,有一个 vcvarsall.bat.
为什么 vs 14.0 中缺少 vcvarsall.bat ??
我以前在尝试安装 numpy 时遇到过这个问题。虽然我无法修复 'vcvarsall.bat' 问题,但我发现我可以从这里下载预编译的库:http://www.lfd.uci.edu/~gohlke/pythonlibs/
下载所需的库,导航到下载的 .whl 文件所在的位置,然后打开命令提示符 window。 运行 'pip install [whl file name]'
这将为您安装库,没有编译问题。
确保 C++ Common Tools 安装在 Visual Studio。
程序和功能 -> VS 2015 -> 更改
我在尝试使用 python 2.7(使用 VS 2015 编译)构建 ujson 包时遇到了这个问题。
- vcvarsall.bat:尝试将 vsvars32.bat(从同一目录 - "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools")复制到 vcvarsall.bat。这就是构建所需的一切
- 另一个问题是在函数 get_build_version() (distutils/msvc9compiler.py) 中检测 VS 版本。您需要将此功能更改为 return 正确的 VS 版本。
有这一行:
majorVersion = int(s[:-2]) - 6
它将主要版本设置为 13,但 VS 2015 的正确版本是 14。因此您需要添加两行,例如:
if majorVersion == 13:
majorVersion = 14
我下载了 Microsoft Visual C++ 构建工具 Link Here,一切正常。
我刚遇到同样的问题(Windows 7,Python 3.4,pip 7.1)
pip install mysqlclient
(...)
error: Unable to find vcvarsall.bat
我遵循了这些说明:https://www.linkedin.com/pulse/resolving-python-error-unable-find-vcvarsallbat-bhanu-pratap-singh/
然后用
将pip升级到9.0.1
python -m pip install --upgrade pip
再次尝试:
pip install mysqlclient
瞧瞧:
Successfully installed mysqlclient-1.3.12
在安装任何 Python 2.7 模块时 如果遇到错误:
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)
Windows OS 解
最简单的解决方案是:
- 浏览到 URL
http://aka.ms/vcpython27
- 下载 Microsoft Visual C++ 编译器 Python 2.7
- 快照:
- 版本:9.0.0.30729
- 文件名:VCForPython27.msi
- 发布日期:2014 年 9 月 29 日
- 文件大小:83.8 MB
详情:
This package contains the compiler and set of system headers necessary for producing binary wheels for Python packages. A binary wheel of a Python package can then be installed on any Windows system without requiring access to a C compiler.
The typical error message you will receive if you need this compiler package is Unable to find vcvarsall.bat
This message appears because the Python package being installed contains the source code for a native extension module (.pyd), but does not have a pre-built copy of the module. The Python packages highlighted at pythonwheels.com have already been updated by their developers to include pre-built binaries, but many are still only available as source code.
This compiler package is entirely unsupported and represents a snapshot of the last version that is fully compatible with Python 2.7. For the latest security and bug fixes, please use the latest version of Microsoft Visual Studio for any development work that does not directly interface with Python 2.7.
- 系统要求:
- 支持的操作系统:Windows7,Windows8,Windows8.1
- Microsoft Visual C++ 2008 SP1 可再发行组件包(x86、x64)
Windows 8 及更高版本需要 Microsoft .NET Framework 3.5。请参阅此处了解安装说明。
- 磁盘Space要求:安装需要 380 兆字节 (MB) 的硬盘space。
- Python 包
Python 需要 setuptools 6.0 或更高版本才能自动检测此编译器包。
建议使用 wheel 来生成预构建的二进制包。
- 安装说明:
- 安装和卸载编译器包将默认为当前用户安装,不需要管理权限。要为计算机的所有用户安装,请从提升的命令提示符执行 msiexec /i ALLUSERS=1。
- 与Python分发工具一起使用
Python 包开发人员应下载并使用此编译器为他们的 Python 包生成二进制轮子以上传到 PyPI。安装 wheel 包,更新到 setuptools 6.0 或更高版本,并将 setup.py bdist_wheel upload 添加到您的构建过程将生成正确的文件(请记住对 32 位和 64 位版本都执行此操作) .
- 如果您正在安装的Python包没有轮子,您可以在您自己的机器上安装这个编译器包。安装编译器并更新到 setuptools 6.0 或更高版本后,您可以使用 pip install 来构建和安装 Python 包。如果您管理多台机器并且需要在所有机器上安装 Python 包,您应该安装 wheel 包并使用 pip wheel 生成一个可以安装在机器上的轮子,而不需要这个包。
- 在您的本地主机上安装包。
- 成功安装所需的 Python 2.7 模块。
我正在尝试在 python 3.5 中安装 numpy windows 10 并安装了 visual studio 2015 ultimate。
简短版本:vs14 文件夹 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
文件夹中缺少文件 vcvarsall.bat
。为什么?
长版:
运行 pip install numpy
给我这个错误 error: Unable to find vcvarsall.bat
研究这个错误让我得到了几个 Whosebug 的答案,这些答案帮助我弄清楚 python 需要 c++ 编译器来编译一些包。它需要使用与编译 python 3.5 ( error: Unable to find vcvarsall.bat)。我的 python 是使用 [MSC v.1900 64 位 (AMD64)] 编译的 - 这是 vs 14 ( visual studio 2015 )
通过进一步研究,我了解到:
pip install gives error: Unable to find vcvarsall.bat那个
get_build_version()
来自 $python_install_prefix/Lib/distutils/msvc9compiler.py
returns 应该用来查找 vcvarsall.bat
路径的 vs 版本
对我来说这个方法returns 14。所以一切正确。
现在,当我查看文件夹 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
时,发现缺少文件 vcvarsall.bat。
但是当我查看文件夹 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC
时,有一个 vcvarsall.bat.
为什么 vs 14.0 中缺少 vcvarsall.bat ??
我以前在尝试安装 numpy 时遇到过这个问题。虽然我无法修复 'vcvarsall.bat' 问题,但我发现我可以从这里下载预编译的库:http://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载所需的库,导航到下载的 .whl 文件所在的位置,然后打开命令提示符 window。 运行 'pip install [whl file name]' 这将为您安装库,没有编译问题。
确保 C++ Common Tools 安装在 Visual Studio。
程序和功能 -> VS 2015 -> 更改
我在尝试使用 python 2.7(使用 VS 2015 编译)构建 ujson 包时遇到了这个问题。
- vcvarsall.bat:尝试将 vsvars32.bat(从同一目录 - "c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools")复制到 vcvarsall.bat。这就是构建所需的一切
- 另一个问题是在函数 get_build_version() (distutils/msvc9compiler.py) 中检测 VS 版本。您需要将此功能更改为 return 正确的 VS 版本。
有这一行:
majorVersion = int(s[:-2]) - 6
它将主要版本设置为 13,但 VS 2015 的正确版本是 14。因此您需要添加两行,例如:
if majorVersion == 13:
majorVersion = 14
我下载了 Microsoft Visual C++ 构建工具 Link Here,一切正常。
我刚遇到同样的问题(Windows 7,Python 3.4,pip 7.1)
pip install mysqlclient
(...)
error: Unable to find vcvarsall.bat
我遵循了这些说明:https://www.linkedin.com/pulse/resolving-python-error-unable-find-vcvarsallbat-bhanu-pratap-singh/
然后用
将pip升级到9.0.1python -m pip install --upgrade pip
再次尝试:
pip install mysqlclient
瞧瞧:
Successfully installed mysqlclient-1.3.12
在安装任何 Python 2.7 模块时 如果遇到错误:
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)
Windows OS 解
最简单的解决方案是:
- 浏览到 URL
http://aka.ms/vcpython27
- 下载 Microsoft Visual C++ 编译器 Python 2.7
- 快照:
- 版本:9.0.0.30729
- 文件名:VCForPython27.msi
- 发布日期:2014 年 9 月 29 日
- 文件大小:83.8 MB
详情:
This package contains the compiler and set of system headers necessary for producing binary wheels for Python packages. A binary wheel of a Python package can then be installed on any Windows system without requiring access to a C compiler.
The typical error message you will receive if you need this compiler package is Unable to find vcvarsall.bat
This message appears because the Python package being installed contains the source code for a native extension module (.pyd), but does not have a pre-built copy of the module. The Python packages highlighted at pythonwheels.com have already been updated by their developers to include pre-built binaries, but many are still only available as source code.
This compiler package is entirely unsupported and represents a snapshot of the last version that is fully compatible with Python 2.7. For the latest security and bug fixes, please use the latest version of Microsoft Visual Studio for any development work that does not directly interface with Python 2.7.
- 系统要求:
- 支持的操作系统:Windows7,Windows8,Windows8.1
- Microsoft Visual C++ 2008 SP1 可再发行组件包(x86、x64) Windows 8 及更高版本需要 Microsoft .NET Framework 3.5。请参阅此处了解安装说明。
- 磁盘Space要求:安装需要 380 兆字节 (MB) 的硬盘space。
- Python 包 Python 需要 setuptools 6.0 或更高版本才能自动检测此编译器包。 建议使用 wheel 来生成预构建的二进制包。
- 安装说明:
- 安装和卸载编译器包将默认为当前用户安装,不需要管理权限。要为计算机的所有用户安装,请从提升的命令提示符执行 msiexec /i ALLUSERS=1。
- 与Python分发工具一起使用 Python 包开发人员应下载并使用此编译器为他们的 Python 包生成二进制轮子以上传到 PyPI。安装 wheel 包,更新到 setuptools 6.0 或更高版本,并将 setup.py bdist_wheel upload 添加到您的构建过程将生成正确的文件(请记住对 32 位和 64 位版本都执行此操作) .
- 如果您正在安装的Python包没有轮子,您可以在您自己的机器上安装这个编译器包。安装编译器并更新到 setuptools 6.0 或更高版本后,您可以使用 pip install 来构建和安装 Python 包。如果您管理多台机器并且需要在所有机器上安装 Python 包,您应该安装 wheel 包并使用 pip wheel 生成一个可以安装在机器上的轮子,而不需要这个包。
- 在您的本地主机上安装包。
- 成功安装所需的 Python 2.7 模块。