Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

python - 错误:找不到vcvarsall.bat(error: Unable to find vcvarsall.bat)

I tried to install the Python package dulwich :

(我试图安装Python软件包dulwich :)

pip install dulwich

But I get a cryptic error message:

(但是我收到了一个神秘的错误消息:)

error: Unable to find vcvarsall.bat

The same happens if I try installing the package manually:

(如果我尝试手动安装软件包,也会发生相同的情况:)

> python setup.py install
running build_ext
building 'dulwich._objects' extension
error: Unable to find vcvarsall.bat
  ask by okada translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Update : Comments point out that the instructions here may be dangerous.

(更新 :评论指出此处的说明可能很危险。)

Consider using the Visual C++ 2008 Express edition or the purpose-built Microsoft Visual C++ Compiler for Python ( details ) and NOT using the original answer below.

(考虑使用Visual C ++ 2008 Express版或专用于Python的Microsoft Visual C ++编译器详细信息 ),而不要使用下面的原始答案。)

Original error message means the required version of Visual C++ is not installed.

(原始错误消息表示未安装所需的Visual C ++版本。)


For Windows installations:

(对于Windows安装:)

While running setup.py for package installations, Python 2.7 searches for an installed Visual Studio 2008. You can trick Python to use a newer Visual Studio by setting the correct path in VS90COMNTOOLS environment variable before calling setup.py .

(在运行setup.py进行软件包安装时,Python 2.7搜索已安装的Visual Studio2008。通过在调用setup.py之前在VS90COMNTOOLS环境变量中设置正确的路径,可以诱使Python使用更新的Visual Studio。)

Execute the following command based on the version of Visual Studio installed:

(根据安装的Visual Studio版本执行以下命令:)

  • Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%

    (Visual Studio 2010(VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%)

  • Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%

    (Visual Studio 2012(VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%)

  • Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%

    (Visual Studio 2013(VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%)

  • Visual Studio 2015 (VS14): SET VS90COMNTOOLS=%VS140COMNTOOLS%

    (Visual Studio 2015(VS14): SET VS90COMNTOOLS=%VS140COMNTOOLS%)


WARNING: As noted below, this answer is unlikely to work if you are trying to compile python modules.

(警告:如下所述,如果您尝试编译python模块,此答案不太可能起作用。)

See Building lxml for Python 2.7 on Windows for details.

(有关详细信息,请参见在Windows上为Python 2.7构建lxml 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...