欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

如何正确pipinstallpyscipopt

时间:2023-06-04
1、看错误日志,如果出现了:

error: Microsoft Visual C++ 14.0 is required
看这篇博文解决方案,下载对应的版本就好了(注意:要细看评论区的内容)
我选择了百度网盘下载 Microsoft Visual C++ 15.0。
网盘链接(用XX猴,懂得都懂):
https://pan.baidu.com/s/19F4YurwwZ5A9WF5txzMZoQ 提取码:ka7q

2.经历了痛苦的等待后(实际很开心)

直接下载安装完后,又出现了新的问题(我随便拿别人的,我的python版本是3.8):

(base) C:Usersclaire>pip install pyscipoptCollecting pyscipopt Using cached https://files.pythonhosted.org/packages/a7/47/e3d5fcc37138c0eb9695d7c26e22b999c1274b06606db183c2aa36f98e5a/PySCIPOpt-2.2.0.tar.gzBuilding wheels for collected packages: pyscipopt Building wheel for pyscipopt (setup.py) ..、error ERROR: Complete output from command 'C:UsersclaireAnaconda3python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsersclaireAppDataLocalTemppip-wheel-jnmor4q4' --python-tag cp37: ERROR: Using include path . Using SCIP library at . running bdist_wheel running build running build_py creating build creating buildlib.win-amd64-3.7 creating buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptMultidict.py -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipopt__init__.py -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptscip.pyx -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptscip.pxd -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbenders.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbenderscut.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbranchrule.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptconshdlr.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptevent.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptexpr.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptheuristic.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptlp.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpresol.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpricer.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpropagator.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptrelax.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptsepa.pxi -> buildlib.win-amd64-3.7pyscipopt running build_ext building 'pyscipopt.scip' extension creating buildtemp.win-amd64-3.7 creating buildtemp.win-amd64-3.7Release creating buildtemp.win-amd64-3.7Releasesrc creating buildtemp.win-amd64-3.7Releasesrcpyscipopt C:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:UsersclaireAppDataLocalTemppip-install-zja79xrmpyscipoptsrc -IC:UsersclaireAnaconda3include -IC:UsersclaireAnaconda3include "-IC:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726include" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0cppwinrt" /Tcsrcpyscipoptscip.c /Fobuildtemp.win-amd64-3.7Releasesrcpyscipoptscip.obj scip.c srcpyscipoptscip.c(621): fatal error C1083: Cannot open include file: 'scip/scip.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe' failed with exit status 2 ---------------------------------------- ERROR: Failed building wheel for pyscipopt Running setup.py clean for pyscipoptFailed to build pyscipoptInstalling collected packages: pyscipopt Running setup.py install for pyscipopt ..、error ERROR: Complete output from command 'C:UsersclaireAnaconda3python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersclaireAppDataLocalTemppip-record-aw3wx8loinstall-record.txt' --single-version-externally-managed --compile: ERROR: Using include path . Using SCIP library at . running install running build running build_py creating build creating buildlib.win-amd64-3.7 creating buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptMultidict.py -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipopt__init__.py -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptscip.pyx -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptscip.pxd -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbenders.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbenderscut.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptbranchrule.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptconshdlr.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptevent.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptexpr.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptheuristic.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptlp.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpresol.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpricer.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptpropagator.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptrelax.pxi -> buildlib.win-amd64-3.7pyscipopt copying srcpyscipoptsepa.pxi -> buildlib.win-amd64-3.7pyscipopt running build_ext building 'pyscipopt.scip' extension creating buildtemp.win-amd64-3.7 creating buildtemp.win-amd64-3.7Release creating buildtemp.win-amd64-3.7Releasesrc creating buildtemp.win-amd64-3.7Releasesrcpyscipopt C:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726binHostX86x64cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:UsersclaireAppDataLocalTemppip-install-zja79xrmpyscipoptsrc -IC:UsersclaireAnaconda3include -IC:UsersclaireAnaconda3include "-IC:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726ATLMFCinclude" "-IC:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726include" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0ucrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0shared" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0um" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0winrt" "-IC:Program Files (x86)Windows Kits10include10.0.17134.0cppwinrt" /Tcsrcpyscipoptscip.c /Fobuildtemp.win-amd64-3.7Releasesrcpyscipoptscip.obj scip.c srcpyscipoptscip.c(621): fatal error C1083: Cannot open include file: 'scip/scip.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe' failed with exit status 2 ----------------------------------------ERROR: Command "'C:UsersclaireAnaconda3python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\Users\claire\AppData\Local\Temp\pip-install-zja79xrm\pyscipopt\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersclaireAppDataLocalTemppip-record-aw3wx8loinstall-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:UsersclaireAppDataLocalTemppip-install-zja79xrmpyscipopt

其实真正的问题是:

你在C:Program FilesSCIPOptSuite-6.0.2include这个文件夹找不到scip.h文件。
这是因为你缺了SCIP优化组件,然后我就去这个网址:
https://www.scipopt.org/download.php?fname=SCIPOptSuite-6.0.2-win64-VS15.exe
下载了对应的版本。

上述链接的安装教程:

https://www.cnblogs.com/dengfaheng/p/10041488.html

按步骤安装好后其实问题还没有真正解决。

还是出现了同样的错误,那是因为prompt不能知道你到底把SCIP优化组件放在哪个地方,你要写一个命令
set SCIPOPTDIR=“C:Program Files你的SCIP优化组件安装的位置”(我是默认的)
再输入pip install pyscipopt==对应版本,因为它默认安装最新的4.x,所以出错才正常啊,所以它还是会说你在C:Program FilesSCIPOptSuite-6.0.2include这个文件夹找不到scip.h文件。

注意! SCIP优化组件的版本对应要下载的pyscipopt的版本8.04.x7.03.x

那好,由于我下的是6.02版本,那么对应的就要下2.x版本的pyscipopt。
最后就大功告成了。

走过的弯路 找了要去解决这个error: command 'C:Program Files (x86)Microsoft Visual Studio2017EnterpriseVCToolsMSVC14.15.26726binHostX86x64cl.exe’错误的博客,可是没什么卵用。(算是抱怨吧)奶奶的,有那么几篇博文误人子弟,胡说八道,有的说去下SCIP优化组件的tgz解压后放到我的lib文件夹,还有的是要我更新python安装程序的version,现在慢慢的一堆黄黄难看的warning。

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。