简体   繁体   中英

Python 2.7.7 package installation giving Visual C++ cl.exe error: command failed with exit status 2

Python 2.7.7 is giving Visual C++ issues when installing a package. I get the following error:

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. I am on Windows Vista, Python 2.7.7
  2. I installed the package via the Windows cmd terminal, using "setup.py install"
  3. I have installed "Microsoft Visual C++ Compiler for Python 2.7" and ensured the path "C:\\Program Files\\Common Files\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe" contains "cl.exe"
  4. As per the advice here . I have checked that my Visual C++ version is compatible with my version of Python. (I have a "Visual C++ 2008 32-bit Command Prompt" shortcut at "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Microsoft Visual C++ Compiler Package for Python 2.7". The 2008 version is the correct version for my version of python. (both are MSC v.1500.) )
  5. I have updated python setuptools to setuptools 17.1.1

Below is a transcript of the installation process just before the error occured:

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**

I am new to this and have no idea what else to try. Would appreciate any help. Thanks in advance.

Came across this issue when installing pycocotools on windows 10. Python 2.7 does not support Visual C++ 14 that is required to compile C99 code. This is the reason for the compiling errors (C2065,C4133 etc).

I was able to solve this by,

  1. Installing Visual Studio 2015 build tools (this will install C++ 14 compiler).
  2. Installing a new newer version of Python (3.6 recommended)

More about Windows Compilers for Python here . Also check this post .

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM