我尝试使用pip安装chompack,以便在带有cvxopt的支持向量机算法中使用。然而,它给了我一个错误,我没有找到一个明确的答案。有一个related question,但提供的答案非常具体到该人试图安装的软件包。就我而言,我没有可以下载的二进制包,甚至还没有 .whl 文件。
具体错误似乎是
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
这是我在命令提示符(Windows 10 PC)中输入的内容以及完整结果。
pip install chompack
我得到了
Collecting chompack
Using cached chompack-2.2.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cvxopt>=1.1.7 in c:\python27\lib\site-packages (from chompack)
Building wheels for collected packages: chompack
Running setup.py bdist_wheel for chompack ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\my_username\\appdata\\local\\temp\\pip-build-o8y8d4\\chompack\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\my_username\appdata\local\temp\tmpv64_u4pip-wheel- --python-tag cp27:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --python-tag not recognized
----------------------------------------
Failed building wheel for chompack
Running setup.py clean for chompack
Failed to build chompack
Installing collected packages: chompack
Running setup.py install for chompack ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\my_username\\appdata\\local\\temp\\pip-build-o8y8d4\\chompack\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my_username\appdata\local\temp\pip-fkqebc-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\chompack
copying src\python\base.py -> build\lib.win32-2.7\chompack
copying src\python\conversion.py -> build\lib.win32-2.7\chompack
copying src\python\maxchord.py -> build\lib.win32-2.7\chompack
copying src\python\mcs.py -> build\lib.win32-2.7\chompack
copying src\python\misc.py -> build\lib.win32-2.7\chompack
copying src\python\pfcholesky.py -> build\lib.win32-2.7\chompack
copying src\python\symbolic.py -> build\lib.win32-2.7\chompack
copying src\python\__init__.py -> build\lib.win32-2.7\chompack
creating build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\cholesky.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\completion.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\edmcompletion.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\hessian.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\llt.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\plot.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\projected_inverse.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\psdcompletion.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\trmm.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\trsm.py -> build\lib.win32-2.7\chompack\pybase
copying src\python\pybase\__init__.py -> build\lib.win32-2.7\chompack\pybase
running build_ext
building 'cbase' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
creating build\temp.win32-2.7\Release\src\C
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\python27\include -Ic:\python27\PC /Tcsrc/C\cbase.c /Fobuild\temp.win32-2.7\Release\src/C\cbase.obj
cbase.c
c:\users\my_username\appdata\local\temp\pip-build-o8y8d4\chompack\src\c\cvxopt.h(31) : fatal error C1083: Cannot open include file: 'complex.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\my_username\\appdata\\local\\temp\\pip-build-o8y8d4\\chompack\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my_username\appdata\local\temp\pip-fkqebc-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\my_username\appdata\local\temp\pip-build-o8y8d4\chompack
答案 0 :(得分:0)
我不知道确切的原因,但你应该使用python本身来安装包chompack
:
python -m pip install chompack
有关更多信息,请阅读手册:https://docs.python.org/3/installing/
PS:我看过同样的消息,但无论如何都安装了它。