" pip install mysqlclient"抛出错误:无法找到vcvarsall.bat

时间:2018-05-19 20:05:52

标签: python pip

我正在尝试在python 2.7中安装mysqlclient模块。使用pip和easy_install会出现以下错误

> easy_install mysqlclient


Searching for mysqlclient
Reading https://pypi.python.org/simple/mysqlclient/
Best match: mysqlclient 1.3.12
Downloading https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2
adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz#sha256=2d9ec33d
e39f4d9c64ad7322ede0521d85829ce36a76f9dd3d6ab76a9c8648e5
Processing mysqlclient-1.3.12.tar.gz
Writing c:\users\home\appdata\local\temp\easy_install-9oa3ct\mysqlclient-1.3.12\
setup.cfg
Running mysqlclient-1.3.12\setup.py -q bdist_egg --dist-dir c:\users\home\appdat
a\local\temp\easy_install-9oa3ct\mysqlclient-1.3.12\egg-dist-tmp-kxvslf
error: Setup script exited with error: Unable to find vcvarsall.bat

同样的错误也与pip有关。 我知道有些模块包含C代码,需要在安装之前进行编译,因此我安装了 Microsoft Visual C++ Compiler for Python并将 vcvarsall.bat 的位置添加到新的系统环境变量 VS90COMNTOOLS (其他答案显示这是pip搜索vcvarsall.bat位置的地方)但我仍然遇到同样的错误。

我是否需要在其他地方添加它的路径?在开始编译之前,pip和easy_install在哪里搜索文件?我该如何解决这个错误?

1 个答案:

答案 0 :(得分:0)

对我来说解决的是使用:

pip install --only-binary :all: mysqlclient