Python 2.7.7包安装,提供VisualC++ + C.exe错误:命令退出失败状态2

2024-04-28 22:16:38 发布

您现在位置:Python中文网/ 问答频道 /正文

Python 2.7.7在安装包时给出VisualC++问题。我得到以下错误:

error: Setup script exited with error: command 'C:\\Program Files\\Common Files\
    \Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status
     2*
  1. 我使用的是WindowsVista,Python2.7.7
  2. 我使用“setup.py install”通过Windows cmd终端安装了这个包
  3. 我安装了“微软Python 2.7的Visual C++编译器”,并确保路径“C:\程序文件\公用文件\Python \Visual C++ + Python \\\VC\bin \C.exe”包含“C.exe”
  4. 按照建议here。我已经检查过我的VisualC++版本与我的Python版本兼容。(我有一个“Visual C++ 2008 32位命令提示符”快捷方式在“C++:程序数据\微软\ Windows \开始菜单\程序\微软Visual C++编译器包中的Python 2.7”。2008版本是我的python版本的正确版本。(两者均为MSC v.1500.)
  5. 我已将python setuptools更新为setuptools 17.1.1

下面是发生错误之前的安装过程的副本:

Searching for python-axolotl-curve25519
Reading https://pypi.python.org/simple/python-axolotl-curve25519/
Best match: python-axolotl-curve25519 0.1
Downloading https://pypi.python.org/packages/source/p/python-axolotl-curve25519/
python-axolotl-curve25519-0.1.tar.gz#md5=f28d902df9044f0bf86a35a4bd2ec092
Processing python-axolotl-curve25519-0.1.tar.gz
Writing c:\users\eg\appdata\local\temp\easy_install-l68mxp\python-axolotl-curve2
5519-0.1\setup.cfg
Running python-axolotl-curve25519-0.1\setup.py -q bdist_egg --dist-dir c:\users\
eg\appdata\local\temp\easy_install-l68mxp\python-axolotl-curve25519-0.1\egg-dist
-tmp-hvxf2n
curve25519module.c
curve25519module.c(76) : error C2143: syntax error : missing ';' before 'type'
curve25519module.c(78) : error C2065: 'result' : undeclared identifier
curve25519module.c(82) : error C2143: syntax error : missing '{' before '*'
curve25519module.c(100) : warning C4133: 'return' : incompatible types - from 'P
yObject *' to 'int *'
curve25519module.c(146) : warning C4133: 'initializing' : incompatible types - f
rom 'int *(__cdecl *)(PyObject *,PyObject *)' to 'PyCFunction'
**error: Setup script exited with error: command 'C:\\Program Files\\Common Files\
\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status
 2**

我是新来的,不知道还能尝试什么。希望能得到帮助。提前谢谢。


Tags: install程序版本for错误withsetuperror
1条回答
网友
1楼 · 发布于 2024-04-28 22:16:38

在Windows10上安装Pycools时遇到了这个问题。Python 2.7不支持编译C99代码所需的Visual C++ 14。这就是编译错误的原因(c265、C4133等)。

我能解决这个问题

  1. 安装VisualStudio 2015构建工具(这将安装C++ 14编译器)。
  2. 安装新版本的Python(推荐3.6)

有关用于Pythonhere的Windows编译器的详细信息。还要检查这个post

enter image description here

相关问题 更多 >