【问题标题】:"pip install mysqlclient" throws error: Unable to find vcvarsall.bat“pip install mysqlclient”抛出错误:无法找到 vcvarsall.bat
【发布时间】:2018-10-29 22:36:33
【问题描述】:

我正在尝试在 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 在开始编译之前在哪里搜索文件?如何解决此错误?

【问题讨论】:

  • 安装C++编译器后是否启动了新的shell?
  • 是的,我确实启动了一个新的外壳。
  • pip 或 easy_install 在哪里搜索文件?

标签: python pip


【解决方案1】:

为我解决的是使用:

pip install --only-binary :all: mysqlclient

【讨论】:

    猜你喜欢
    • 2013-11-18
    • 2014-09-07
    • 2014-08-14
    • 2016-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-18
    相关资源
    最近更新 更多