我尝试通过使用以下指南执行“pip install pyscipopt”来使用 pip 安装 PySCIPOpt: https://github.com/scipopt/PySCIPOpt/blob/master/INSTALL.md 并查看具有相同问题的不同问题。我在 64 位 Windows 10 机器上使用 Anaconda 运行 Python 3.8。
我已经成功安装了 SCIP 优化套件。我确实有文件夹 lib 和 include,在文件夹 include 中有一个文件 scip\scip.h。最后我安装了 Microsoft Visual C++ 14.0。
我在 Anaconda Prompt 中运行以下命令:
set SCIPOPTDIR=C:\Program Files\SCIPOptSuite 7.0.0
pip install pyscipopt
我也尝试过不同的变体,例如:
set SCIPOPTDIR="C:\Program Files\SCIPOptSuite 7.0.0"
set PATH=%PATH%;%SCIPOPTDIR%\bin
python -m pip install pyscipopt
但是我一直收到以下错误消息。我做错了什么?
Collecting PySCIPOpt
Using cached PySCIPOpt-3.1.0.tar.gz (619 kB)
Building wheels for collected packages: PySCIPOpt
Building wheel for PySCIPOpt (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\<>\anaconda3\envs\<>\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\setup.py'"'"'; __file__='"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\<>\AppData\Local\Temp\pip-wheel-qi79u70_'
cwd: C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\
Complete output (29 lines):
Using include path <C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\src>.
Using SCIP library <libscip> at <C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\lib>.
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\Multidict.py -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\__init__.py -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\scip.pyx -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\scip.pxd -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\benders.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\benderscut.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\branchrule.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\conshdlr.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\event.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\expr.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\heuristic.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\lp.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\nodesel.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\presol.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\pricer.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\propagator.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\relax.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\sepa.pxi -> build\lib.win-amd64-3.8\pyscipopt
running build_ext
building 'pyscipopt.scip' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for PySCIPOpt
Running setup.py clean for PySCIPOpt
Failed to build PySCIPOpt
Installing collected packages: PySCIPOpt
Running setup.py install for PySCIPOpt ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\<>\anaconda3\envs\<>\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\setup.py'"'"'; __file__='"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\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\<>\AppData\Local\Temp\pip-record-o4qinppn\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\<>\anaconda3\envs\<>\Include\PySCIPOpt'
cwd: C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\
Complete output (29 lines):
Using include path <C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\src>.
Using SCIP library <libscip> at <C:\Users\<>\AppData\Local\Temp\pip-install-b0tospyz\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\lib>.
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\Multidict.py -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\__init__.py -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\scip.pyx -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\scip.pxd -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\benders.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\benderscut.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\branchrule.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\conshdlr.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\event.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\expr.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\heuristic.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\lp.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\nodesel.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\presol.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\pricer.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\propagator.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\relax.pxi -> build\lib.win-amd64-3.8\pyscipopt
copying src\pyscipopt\sepa.pxi -> build\lib.win-amd64-3.8\pyscipopt
running build_ext
building 'pyscipopt.scip' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\<>\anaconda3\envs\<>\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\setup.py'"'"'; __file__='"'"'C:\\Users\\<>\\AppData\\Local\\Temp\\pip-install-b0tospyz\\pyscipopt_5f447b30c7094ccaa5631ff01e4dab0a\\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\<>\AppData\Local\Temp\pip-record-o4qinppn\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\<>\anaconda3\envs\<>\Include\PySCIPOpt' Check the logs for full command output.