Python pip安装cvxopt错误:命令'C:\\Program Files(x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86\u amd64\\cl.exe文件'失败,退出状态为2

2024-07-08 09:54:42 发布

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

尝试使用“pip install”安装cvxopt。使用window10、python3.6.4(64位),并且已经安装了Microsoft Build Tools 2015和Visual Studio 14.0。我也没有幸运地直接从PyPI下载了这个模块。需要这个优化教程所以有什么建议吗?这是命令行:

C:\>pip install cvxopt
Collecting cvxopt
  Using cached cvxopt-1.1.9.tar.gz
Installing collected packages: cvxopt
  Running setup.py install for cvxopt ... error
Complete output from command c:\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Clayton\\AppData\\Local\\Temp\\pip-build-81vbp793\\cvxopt\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Clayton\AppData\Local\Temp\pip-xcv57jyr-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\cvxopt
copying src\python\coneprog.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\cvxprog.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\info.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\misc.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\modeling.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\msk.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\printing.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\solvers.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\_version.py -> build\lib.win-amd64-3.6\cvxopt
copying src\python\__init__.py -> build\lib.win-amd64-3.6\cvxopt
UPDATING build\lib.win-amd64-3.6\cvxopt/_version.py
set build\lib.win-amd64-3.6\cvxopt/_version.py to '1.1.9'
running build_ext
building 'base' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\src
creating build\temp.win-amd64-3.6\Release\src\C
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\python36\include -Ic:\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\winrt" /Tcsrc/C/base.c /Fobuild\temp.win-amd64-3.6\Release\src/C/base.obj
base.c
c:\users\clayton\appdata\local\temp\pip-build-81vbp793\cvxopt\src\c\misc.h(35): error C2146: syntax error: missing ';' before identifier 'z'
c:\users\clayton\appdata\local\temp\pip-build-81vbp793\cvxopt\src\c\misc.h(35): error C2061: syntax error: identifier 'z'
c:\users\clayton\appdata\local\temp\pip-build-81vbp793\cvxopt\src\c\misc.h(36): error C2059: syntax error: '}'
src/C/base.c(46): error C2122: 'void *': prototype parameter in name list illegal
src/C/base.c(46): error C2122: 'int': prototype parameter in name list illegal
src/C/base.c(46): error C2122: 'void **': prototype parameter in name list illegal
src/C/base.c(49): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(52): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(55): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(58): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(60): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(60): error C2061: syntax error: identifier '_complex'
src/C/base.c(60): error C2059: syntax error: ')'
src/C/base.c(67): error C2061: syntax error: identifier 'One'
src/C/base.c(67): error C2059: syntax error: ';'
src/C/base.c(67): error C2059: syntax error: '['
src/C/base.c(79): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(79): error C2065: '_complex': undeclared identifier
src/C/base.c(79): error C2059: syntax error: ')'
src/C/base.c(79): error C2297: '*': illegal, right operand has type 'void'
src/C/base.c(79): error C2143: syntax error: missing ')' before ';'
src/C/base.c(95): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(95): error C2065: '_complex': undeclared identifier
src/C/base.c(95): error C2059: syntax error: ')'
src/C/base.c(95): error C2297: '*': illegal, right operand has type 'void'
src/C/base.c(95): error C2143: syntax error: missing ')' before ';'
src/C/base.c(96): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(96): error C2065: '_complex': undeclared identifier
src/C/base.c(96): error C2059: syntax error: ')'
src/C/base.c(96): error C2297: '*': illegal, right operand has type 'void'
src/C/base.c(96): error C2143: syntax error: missing ')' before ';'
src/C/base.c(134): warning C4244: '=': conversion from 'Py_ssize_t' to 'double', possible loss of data
src/C/base.c(157): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(157): error C2065: '_complex': undeclared identifier
src/C/base.c(157): error C2100: illegal indirection
src/C/base.c(157): error C2059: syntax error: ')'
src/C/base.c(157): error C2297: '*': illegal, right operand has type 'void *'
src/C/base.c(159): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(159): error C2065: '_complex': undeclared identifier
src/C/base.c(159): error C2100: illegal indirection
src/C/base.c(159): error C2059: syntax error: ')'
src/C/base.c(159): error C2297: '*': illegal, right operand has type 'void *'
src/C/base.c(161): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(161): error C2065: '_complex': undeclared identifier
src/C/base.c(161): error C2100: illegal indirection
src/C/base.c(161): error C2059: syntax error: ')'
src/C/base.c(161): error C2297: '*': illegal, right operand has type 'void *'
src/C/base.c(161): error C2297: '*': illegal, right operand has type 'void'
src/C/base.c(161): error C2143: syntax error: missing ')' before ';'
src/C/base.c(166): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(166): error C2065: '_complex': undeclared identifier
src/C/base.c(166): error C2100: illegal indirection
src/C/base.c(166): error C2059: syntax error: ')'
src/C/base.c(166): error C2297: '*': illegal, right operand has type 'void *'
src/C/base.c(166): error C2088: '*': illegal for struct
src/C/base.c(247): warning C4244: 'function': conversion from 'Py_ssize_t' to 'long', possible loss of data
src/C/base.c(259): error C2146: syntax error: missing ')' before identifier '_complex'
src/C/base.c(259): error C2065: '_complex': undeclared identifier
src/C/base.c(259): error C2059: syntax error: ')'
src/C/base.c(259): error C2297: '*': illegal, right operand has type 'void'
src/C/base.c(259): error C2143: syntax error: missing ')' before ';'
src/C/base.c(264): error C2146: syntax error: missing ')' before identifier 'a'
src/C/base.c(264): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(264): error C2061: syntax error: identifier 'a'
src/C/base.c(264): error C2059: syntax error: ';'
src/C/base.c(264): error C2059: syntax error: ','
src/C/base.c(264): error C2059: syntax error: ')'
src/C/base.c(273): error C2146: syntax error: missing ')' before identifier 'a'
src/C/base.c(273): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(273): error C2061: syntax error: identifier 'a'
src/C/base.c(273): error C2059: syntax error: ';'
src/C/base.c(273): error C2059: syntax error: ','
src/C/base.c(273): error C2059: syntax error: ')'
src/C/base.c(281): error C2146: syntax error: missing ')' before identifier 'a'
src/C/base.c(281): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(281): error C2061: syntax error: identifier 'a'
src/C/base.c(281): error C2059: syntax error: ';'
src/C/base.c(281): error C2059: syntax error: ','
src/C/base.c(281): error C2059: syntax error: ')'
src/C/base.c(291): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(291): error C2065: 'idiv': undeclared identifier
src/C/base.c(291): error C2065: 'ddiv': undeclared identifier
src/C/base.c(291): error C2065: 'zdiv': undeclared identifier
src/C/base.c(291): error C2099: initializer is not a constant
src/C/base.c(293): error C2146: syntax error: missing ')' before identifier 'a'
src/C/base.c(293): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(293): error C2061: syntax error: identifier 'a'
src/C/base.c(293): error C2059: syntax error: ';'
src/C/base.c(293): error C2059: syntax error: ','
src/C/base.c(293): error C2059: syntax error: ')'
src/C/base.c(302): error C2146: syntax error: missing ')' before identifier 'a'
src/C/base.c(302): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(302): error C2061: syntax error: identifier 'a'
src/C/base.c(302): error C2059: syntax error: ';'
src/C/base.c(302): error C2059: syntax error: ','
src/C/base.c(302): error C2059: syntax error: ')'
src/C/base.c(311): error C2081: 'number': name in formal parameter list illegal
src/C/base.c(311): error C2065: 'mtx_irem': undeclared identifier
src/C/base.c(311): error C2065: 'mtx_drem': undeclared identifier
src/C/base.c(311): error C2099: initializer is not a constant
src/C/base.c(360): error C2065: 'number': undeclared identifier
src/C/base.c(360): error C2146: syntax error: missing ';' before identifier 'a'
src/C/base.c(360): error C2065: 'a': undeclared identifier
src/C/base.c(360): fatal error C1003: error count exceeds 100; stopping compilation
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Clayton\\AppData\\Local\\Temp\\pip-build-81vbp793\\cvxopt\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Clayton\AppData\Local\Temp\pip-xcv57jyr-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Clayton\AppData\Local\Temp\pip-build-81vbp793\cvxopt\

谢谢,提前


Tags: pybuildsrcbaseerrorwinamd64identifier
2条回答

cvxopt很难从源代码(尤其是在windows上)安装,因为有一些严重的依赖关系(BLAS、LAPACK、SuiteSparse)。在您的例子中,由于有一些兼容的c编译器设置这一更简单的依赖关系,它已经失败了。在

阅读install-docs你会发现二进制文件只为python2.7和python3.4提供(在windows上)!

因此,要么使用这些python版本中的一个,然后再试一次,或者使用anaconda-distribution并通过condaforge安装,如上面的链接所述。我强烈推荐Python的方式!编辑:没有评论中提到的conda forge中的Windows版本)。在

Sara基于Gohlke二进制文件的方法可以工作。但一般来说(与其他库结合时)更麻烦。在

还有一个official manual windows-install,但是不值得麻烦(而且仍然限于某些python版本)。在

我们需要在cvxopt之前安装numpy+mkl,请检查this并下载numpy+mkl包和相应的cvxopt,然后按如下方式安装:

  1. 打开cd

  2. pip安装“numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl”

  3. pip安装“cvxopt-1.1.9-cp36-cp36m-win_amd64.whl”

相关问题 更多 >

    热门问题