Python Windows 10 和无法找到 vcvarsall.bat
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37534000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Windows 10 and Unable to find vcvarsall.bat
提问by Jacobian
When I try to build one package:
当我尝试构建一个包时:
C:\Linter\intlib\PYTHON>python setup.py build
I get this error message:
我收到此错误消息:
running build
running build_ext
building 'LinPy' extension
error: Unable to find vcvarsall.bat
运行构建
运行 build_ext
构建“LinPy”扩展
错误:无法找到 vcvarsall.bat
This is my Python version:
这是我的 Python 版本:
Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)] on win32
Win32 上的 Python 3.4.4(v3.4.4:737efcadf5a6,2015 年 12 月 20 日,20:20:57)[MSC v.1600 64 位 (AMD64)]
And I'm working on Windows 10 x64. I know about thisthread and dozens of others (like thisand thisand the list goes on). So, I guess I tried almost everything, but nothing works. It seems like all those threads have become outdated, so I need some new receipt. BTW. I tried this:
我正在使用 Windows 10 x64。我知道这个线程和其他几十个线程(比如这个和这个,列表还在继续)。所以,我想我几乎尝试了所有方法,但没有任何效果。似乎所有这些线程都过时了,所以我需要一些新的收据。顺便提一句。我试过这个:
SET VS90COMNTOOLS=%VS100COMNTOOLS%
And this (in Visual Studio 2015 Visual Studio Command Prompt):
这(在 Visual Studio 2015 Visual Studio 命令提示符中):
set DISTUTILS_USE_SDK=1
I looked for vcvarsall.bat
everywhere on my machine, but could not find it.
我vcvarsall.bat
在我的机器上到处寻找,但找不到。
I investigated this folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
, but it does not contain any .bat
files. Anyway, after all my manipulations python setup.py build
still raises the very same error. So, I need help. Thanks!
我调查了这个文件夹C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools
,但它不包含任何.bat
文件。无论如何,毕竟我的操作python setup.py build
仍然会引发同样的错误。所以,我需要帮助。谢谢!
回答by Ani Menon
The issue is caused because you don't have a compiler installed for the receptive build you are trying to run.
导致此问题的原因是您没有为尝试运行的接受构建安装编译器。
The following is what you may require as per the MS Python Engineering community,
根据 MS Python 工程社区,您可能需要以下内容,
Python Version |You will need
------------------------------------
3.5 and later |Visual C++ Build Tools 2015 or Visual Studio 2015
3.3 and 3.4 |Windows SDK for Windows 7 and .NET 4.0
|(Alternatively, Visual Studio 2010 if you have access to it)
2.6 to 3.2 |Microsoft Visual C++ Compiler for Python 2.7
You will need to install: Windows SDK for Windows 7 and .NET 4.0or VS 2010
您需要安装:适用于 Windows 7 和 .NET 4.0或 VS 2010 的Windows SDK
Source: How to deal with the pain of “unable to find vcvarsall.bat”
回答by Moses Koledoye
I did a search for a python wheel of LinPy
unfortunately there happened to be none.
我搜索了一个蟒蛇轮,LinPy
不幸的是碰巧没有。
Cython
has a very good workaround for setting up a windows C/C++ compiler for builds in python. You can find it here. Since you've already downloaded the SDK/.NET framework, you should go ahead and install it as it will be needed as part of the steps. If your system reports there is already an existing version, you may uninstall, restart and reinstall.
Cython
有一个很好的解决方法来为 python 中的构建设置 Windows C/C++ 编译器。你可以在这里找到它。由于您已经下载了 SDK/.NET 框架,您应该继续安装它,因为它是步骤的一部分。如果您的系统报告已经存在一个版本,您可以卸载、重新启动并重新安装。
A hackish alternative is to search for vcvars32.bat
or vcvarsall.bat
(these batch files are only to set up environment variables for compile time) in your Visual studio installation directory. If you don't find any, then you should install the SDK. I managed to do a work around by hardcoding the path to vcvars32.bat
or vcvarsall.bat
in the find_vcvarsall
function of C:\Python34\Lib\distutils\msvc9compiler.py
, but there is a missing library (ISL - Integer Set Library). I think it's because I am using VC11.
一个骇人听闻的替代方法是在您的 Visual Studio 安装目录中搜索vcvars32.bat
或vcvarsall.bat
(这些批处理文件仅用于设置编译时的环境变量)。如果没有找到,则应该安装 SDK。我设法通过硬编码的路径,做一个变通vcvars32.bat
或vcvarsall.bat
在find_vcvarsall
功能C:\Python34\Lib\distutils\msvc9compiler.py
,但存在丢失的库(ISL -整数集库)。我认为这是因为我正在使用 VC11。
I don't have the SDK, but you may try these and see what happens from your end
我没有 SDK,但你可以试试这些,看看你最后会发生什么
回答by denfromufa
You can ease your pains with Microsoft compilers for Python 3.4 by installing mingwpy or libpython (not both):
您可以通过安装 mingwpy 或 libpython(不是两者)来减轻使用适用于 Python 3.4 的 Microsoft 编译器的麻烦:
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
conda install libpython
conda install libpython
回答by Asubiaro Toluwase Victor
Step 1: Install Visual C++ 2010 Express from here.
步骤 1:从这里安装 Visual C++ 2010 Express 。
(Do not install Microsoft Visual Studio 2010 Service Pack 1 )
(不要安装 Microsoft Visual Studio 2010 Service Pack 1 )
Step 2: Remove all the Microsoft Visual C++ 2010 Redistributable packages from Control Panel\Programs and Features. If you don't do those then the install is going to fail with an obscure "Fatal error during installation" error.
步骤 2:从控制面板\程序和功能中删除所有 Microsoft Visual C++ 2010 Redistributable 包。如果你不这样做,那么安装将会失败,并出现一个模糊的“安装过程中的致命错误”错误。
Step 3: Install offline version of Windows SDK for Visual Studio 2010 (v7.1) from here. This is required for 64bit extensions. Windows has builtin mounting for ISOs like Pismo.
第 3 步:从此处安装适用于 Visual Studio 2010 (v7.1) 的离线版 Windows SDK 。这是 64 位扩展所必需的。Windows 已经内置了对像 Pismo 这样的 ISO 的安装。
Step 4: You need to install the ISO file with Pismo File Mount Audit Package. Download Pismo from here
第 4 步:您需要使用 Pismo File Mount Audit Package 安装 ISO 文件。从这里下载 Pismo
Step 5: Right click the downloaded ISO file and choose mount with Pismo. Thereafter, install the Setup\SDKSetup.exe instead of setup.exe.
第 5 步:右键单击下载的 ISO 文件并选择使用 Pismo 安装。此后,安装 Setup\SDKSetup.exe 而不是 setup.exe。
Step 6a: Create a vcvars64.bat file in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 by changing directory to C:\Program Files (x86)\Microsoft Visual Studio version\VC\ on the command prompt.
Type command on the command prompt:
cd C:\Program Files (x86)\Microsoft Visual Studio version\VC\r
步骤 6a:通过将目录更改为 C:\Program Files (x86)\Microsoft Visual Studio version\VC\ on,在 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 中创建一个 vcvars64.bat 文件命令提示符。在命令提示符下键入命令:
cd C:\Program Files (x86)\Microsoft Visual Studio version\VC\r
Step 6b:
To configure this Command Prompt window for 64-bit command-line builds that target x86 platforms, at the command prompt, enter:
vcvarsall x86</p>
步骤 6b:要为面向 x86 平台的 64 位命令行构建配置此命令提示符窗口,请在命令提示符下输入:
vcvarsall x86</p>
回答by Benargee
To add to what Ani Menon answered and addressing Jacobian's(OP) issues he had in response... I had the same issue so I followed this StackOverflow post regarding changing the version number of .NET in the registry temporarily. It's probably a good idea to change the registry value back after.
添加到 Ani Menon 回答的内容并解决他的 Jacobian's(OP) 问题... 之后更改注册表值可能是个好主意。
https://stackoverflow.com/a/33260090/4637870
https://stackoverflow.com/a/33260090/4637870
This succeeded in getting me past the .NET 4 not installed error, but then I was presented with another error towards that the installation was unsuccessful.
这成功地让我通过了 .NET 4 not installed 错误,但随后我遇到了另一个错误,表明安装不成功。
I had to remove both the x86 and x64 instances of the Microsoft Visual C++ 2010 Redistributable and let the SDK install it for me. After doing so I was able to make it all the way through the setup without error. This is where I got my information from:
我必须删除 Microsoft Visual C++ 2010 Redistributable 的 x86 和 x64 实例,并让 SDK 为我安装它。这样做之后,我能够顺利完成设置。这是我从这里获取信息的地方:
论坛:https: //social.msdn.microsoft.com/Forums/windowsdesktop/en-US/381299c9-1bf4-44d4-989c-871735c6b4ca/windows-sdk-for-windows-7-and-net-framework-4-不会安装?论坛=windowssdk
Fix: https://support.microsoft.com/de-de/help/2717426/windows-sdk-fails-to-install-with-return-code-5100
修复:https: //support.microsoft.com/de-de/help/2717426/windows-sdk-fails-to-install-with-return-code-5100
I tried running pip on the same package and the error: Unable to find vcvarsall.bat
is gone.
Now I have a ValueError: ['path']
but thats another issue. Hope this information helps.
我尝试在同一个包上运行 pip 并且error: Unable to find vcvarsall.bat
不见了。现在我有一个ValueError: ['path']
但那是另一个问题。希望这些信息有帮助。
For info on my setup im running windows 7 and python 3.4
有关我的设置的信息,我正在运行 Windows 7 和 python 3.4
回答by carlkl
To use mingwpy instead of the MSVC compiler create a file named pydistutils.cfgin the folder %USERPROFILE%with the following content:
要使用 mingwpy 而不是 MSVC 编译器,请在文件夹%USERPROFILE% 中创建一个名为pydistutils.cfg的文件,其内容如下:
[config]
compiler=mingw32
[build]
compiler=mingw32
[build_ext]
compiler=mingw32
see also How to use MinGW's gcc compiler when installing Python package using Pip?