簡體   English   中英

Python pip install cvxopt 錯誤:命令 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\VC\\\\BIN\\\\x86_amd64\\\\cl.exe' failed with exit status 2

[英]Python pip install cvxopt error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

嘗試使用“pip install”安裝 cvxopt。 使用 Window 10、Python 3.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\

我們需要在 cvxopt 之前安裝 numpy+mkl,請檢查這里並下載 numpy+mkl 包和相應的 cvxopt,然后像下面這樣安裝它們:

  1. 打開 CMD 並 cd 到下載文件夾

  2. 點安裝“numpy-1.13.1+mkl-cp36-cp36m-win_amd64.whl”

  3. 點安裝“cvxopt-1.1.9-cp36-cp36m-win_amd64.whl”

由於一些嚴重的依賴(BLAS、LAPACK、SuiteSparse),cvxopt 很難從源代碼安裝(尤其是在 Windows 上)。 在您的情況下,由於具有一些兼容的 c 編譯器設置的更簡單的依賴關系,它已經失敗了。

閱讀安裝文檔你會看到,二進制文件只提供給 python 2.7 和 python 3.4(在 Windows 上)!

因此,要么使用這些 python 版本之一,然后再做一次, 要么使用 anaconda-distribution並通過 conda-forge 安裝,如上面鏈接中所述。 我強烈推薦anaconda方式! 編輯:如評論中所述,conda-forge 中沒有 Windows 構建)。

Sara 基於 Gohlke 二進制文件的方法可以工作。 但是一般比較麻煩(和其他庫結合的時候)。

還有官方手冊 windows-install但恕我直言它不值得麻煩(並且仍然僅限於某些 python 版本)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

相關問題 安裝tesserocrerror命令'C:\\\\ Program Files(x86)\\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ BIN \\\\ x86_amd64 \\\\ cl.exe'失敗,退出狀態為2 Python pip安裝錯誤:命令“ C:\\\\ Program Files(x86)\\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ BIN \\\\ cl.exe”失敗,退出狀態為2 Python 錯誤:命令 'C:\\\\Program Files (x86)\\\\Microsoft Visual Studio 14.0\\\\VC\\\\bin\\\\cl.exe' 失敗,退出狀態為 2 Python錯誤:命令'C:\\\\ Program Files(x86)\\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ BIN \\\\ cl.exe'失敗,退出狀態為4 錯誤:C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX86\\x64\\cl.exe ' 退出失敗 "C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\2019\\\\BuildTools\\\\VC\\\\Tools\\\\MSVC\\\\14.29.30133\\\\bin\\\\HostX86\\\\x86\\\\cl.exe' 失敗退出狀態為 2" C:\\\\ Program Files \\\\ Microsoft Visual Studio 14.0 \\\\ VC \\\\ bin \\\\ cl.exe'失敗,退出狀態為2 在 Python/PIP 中安裝 REBOUND 時出錯:…Microsoft Visual Studio\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2 在pypy3上安裝熊貓時出錯:…Microsoft Visual Studio 14.0 \\\\ VC \\\\ BIN \\\\ cl.exe'失敗,退出狀態為2 吉普錯誤! 堆棧錯誤:`C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\msbuild.exe` 失敗,退出代碼:1
 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM