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 。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…