[问题] scipy install problem

楼主: SHORTHAPPY   2021-07-18 12:54:49
大家好
我写这题 https://imgur.com/NjXQp5T
import cvxpy和qcqp时出现了下面error
ImportError: cannot import name 'logsumexp' from 'scipy.misc'
(C:\Users\ASUS\anaconda3\lib\site-packages\scipy\misc\__init__.py)
查了google看到logsumexp已经移到scipy.special
要把scipy downgrade到1.2.1版本才会在scipy.misc
所以我试着把sicpy降级
pip install scipy==1.2.1
出现了以下error
ERROR: Command errored out with exit status 1:
'C:\Users\ASUS\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize;
sys.argv[0] =
'"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-vbzm367e\\scipy_be91b562048d490b8443345eddef9e64\\setup.py'"'"';
__file__='"'"'C:\\Users\\ASUS\\AppData\\Local\\Temp\\pip-install-vbzm367e\\scipy_be91b562048d490b8443345eddef9e64\\setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
install
作者: whereweare (whereweare)   2021-07-18 14:54:00
试看看先把 pip upgrade, 相依性问题交给系统处理然后依据碰到的 Error Message 去查 Stackoverflow我估狗你的第一个Error Message 有个页面有简单解法https://github.com/cvxpy/cvxpy/issues/640好像你一开始的解法就把问题弄得更乱囉?
作者: Pieteacher (pieteacher)   2021-07-18 17:14:00
直接用 ridge regression
作者: JamesChen (James)   2021-07-18 21:18:00
限制式是错的。
楼主: SHORTHAPPY   2021-07-18 23:05:00
因为是import cvxpy时发生的错误,没办法从scipy.misc改到scipy.special import啊我把题目连结改成完整的题目了,老师的要求是自己写出最佳解的code,不能用ridge regression的package
作者: whereweare (whereweare)   2021-07-19 00:25:00
我试着重现你的问题 再试着见招拆招conda create --name myenv python=3.6activate myenvpip install qcqp # 重点! qcqp 相依 cvxpy==0.4.x各个相依套件依序装好了... python import 测一下挂了跟你开头第一个 Error Message 一样; pip list 看看scipy 版本到达 1.5.x; 你自己先前查到要版本低些pip uninstall scipy 然后再 pip install scipy==1.2没 error message... python import cvxpy & qcqp OK剩下的就再看看你后续程式码是否顺利执行囉
楼主: SHORTHAPPY   2021-07-19 00:36:00
哇~谢谢 你的python版本是多少的啊?
作者: whereweare (whereweare)   2021-07-19 00:43:00
我是2017装的anaconda3(linux),python是3.6

Links booklink

Contact Us: admin [ a t ] ucptt.com