Python Pip 安装错误 : Unable to find vcvarsall. bat。尝试了所有解决方案

标签 python windows visual-studio python-2.7 pip

我尝试使用

为 Python 2.7.8 (anaconda 2.1.0) 32 位安装 Scrapy
pip install scrapy

我得到了这个错误

 error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).

我已遵循这些 stackover flow 问题中的解决方案。没有任何效果。

Microsoft Visual C++ Compiler for Python 2.7

Can't find vcvarsall.bat file

error: Unable to find vcvarsall.bat

Getting "error: Unable to find vcvarsall.bat" when running "pip install numpy" on windows7 64bit

pip install gives error: Unable to find vcvarsall.bat

How do I point easy_install to vcvarsall.bat?

pip install MySQL-python returns unable to find vcvarsall.bat

这是错误,上下几行:

copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt
-> build\lib.win32-3.4\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

running build_ext

building 'lxml.etree' extension

C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution opt
ion: 'bugtrack_url'

  warnings.warn(msg)

error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat).


----------------------------------------
Command "C:\Python34\python.exe -c "import setuptools, tokenize;__file__='C:
\\Users\\San\\AppData\\Local\\Temp\\pip-build-wp6ei6r9\\lxml\\setup.py';exec(com
pile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __f
ile__, 'exec'))" install --record C:\Users\San\AppData\Local\Temp\pip-kfkzr_67-r
ecord\install-record.txt --single-version-externally-managed --compile" failed w
ith error code 1 in C:\Users\San\AppData\Local\Temp\pip-build-wp6ei6r9\lxml

我有 Microsoft Visual Studio 12.0 和适用于 Python 2.7 的 Microsoft Visual C++ 编译器包,它们都有 vcvarsall.bat 文件。


我有一个名为“VS120COMNTOOLS”的系统变量,它的路径设置为

C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\

我还将两个路径都添加到了我的环境变量中。我也试过只添加一个,然后添加另一个。我的路径是这样的

C:\Program Files\Java\jdk1.7.0_25\bin;\Python27;\Python2\python.exe;C:\Python27\Scripts\;C:\Users\San\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\;C:\Program Files\Microsoft Visual Studio 12.0\VC\;

我还通过我的设置工具进行了更新(我认为是版本 8),它应该自动检测 Microsoft Visual C++ Compiler for Python 2.7。但是,我仍然遇到同样的错误。


我也尝试过使用

easy_install scrapy

我得到了这个错误

error: Setup script exited with error: Microsoft Visual C++ 10.0 is required (Un

能够找到 vcvarsall.bat)。


我的注册表中还有以下内容

HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\9.0\Setup\VC\ProductDir
HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\12.0\Setup\VC\ProductDir

最佳答案

我尝试了所有建议并找到了自己的简单解决方案。

问题是在C等外部环境中编写的代码需要编译器。寻找自己的VS环境,即VS 2008。

目前我的机器运行 VS 2012 并面临 Unable to find vcvarsall.bat。 我研究了要安装的代码以找到 VS 版本。它是 VS 2008。我已添加到系统变量 VS90COMNTOOLS 作为变量名,并给出了 VS120COMNTOOLS 的值。

您可以在下面找到我的分步解决方案:

  1. 右键单击我的电脑。
  2. pip 击属性
  3. 高级系统设置
  4. 环境变量
  5. 添加新系统变量
  6. 变量名输入VS90COMNTOOLS
  7. 将当前版本的值输入到新变量中。
  8. 关闭所有窗口

现在打开一个新 session 并pip install your-package

关于Python Pip 安装错误 : Unable to find vcvarsall. bat。尝试了所有解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27670365/

相关文章:

python - 波浪号 (~) 在 subprocess.Popen() 中不起作用

windows - Powershell-扩展存档和重命名文件,因为其中包含无效字符

python - 为什么 PyObjC 文档如此糟糕?

python - 在 Pyqt 的 qtable 中更改选定字符串的颜色

php - 使用 PHP/OO 将 ODT 转换为 PDF

asp.net-mvc - 如何在 Visual Studio 2012 或 Visual Studio 2013 中打开旧的 MVC 项目?

sql-server - Visual Studio 2013 中的调用目标引发了异常

.net - doxygen 中的相对路径以允许持续集成

python - Python 中的关键字参数

c++ - QKeySequence::Quit 快捷方式在 Windows 中不起作用