作者SHORTHAPPY ()
看板Python
标题[问题] scipy install problem
时间Sun Jul 18 12:54:49 2021
大家好
我写这题
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 --record
'C:\Users\ASUS\AppData\Local\Temp\pip-record-j3bw7xdy\install-record.txt'
--single-version-externally-managed --compile --install-headers
'C:\Users\ASUS\anaconda3\Include\scipy' Check the logs for full command
output.
我又试着安装scipy 1.2.3
pip install scipy-1.2.3-cp34-cp34m-win_amd64.whl
出现了下面error
ERROR: scipy-1.2.3-cp34-cp34m-win_amd64.whl is not a supported wheel on this
platform.
我试着downgrade python版本
conda install python=3.4
好像也fail ><
请问到底怎麽做才能import cvxpy和qcqp啊?
或是我方向根本错了? 有大大知道这题应该怎麽做吗?
谢谢大家m(_ _)m
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 49.216.56.218 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1626584092.A.641.html
1F:→ whereweare: 试看看先把 pip upgrade, 相依性问题交给系统处理 07/18 14:54
2F:→ whereweare: 然後依据碰到的 Error Message 去查 Stackoverflow 07/18 14:56
3F:→ whereweare: 我估狗你的第一个Error Message 有个页面有简单解法 07/18 15:05
5F:→ whereweare: 好像你一开始的解法就把问题弄得更乱罗? 07/18 15:06
6F:→ Pieteacher: 直接用 ridge regression 07/18 17:14
7F:→ JamesChen: 限制式是错的。 07/18 21:18
8F:→ SHORTHAPPY: 因为是import cvxpy时发生的错误,没办法从scipy.misc 07/18 23:05
9F:→ SHORTHAPPY: 改到scipy.special import啊 07/18 23:06
10F:→ SHORTHAPPY: 我把题目连结改成完整的题目了,老师的要求是自己写出 07/18 23:08
11F:→ SHORTHAPPY: 最佳解的code,不能用ridge regression的package 07/18 23:12
※ 编辑: SHORTHAPPY (101.10.14.172 台湾), 07/18/2021 23:12:46
12F:→ whereweare: 我试着重现你的问题 再试着见招拆招 07/19 00:25
13F:→ whereweare: conda create --name myenv python=3.6 07/19 00:28
14F:→ whereweare: activate myenv 07/19 00:29
15F:→ whereweare: pip install qcqp # 重点! qcqp 相依 cvxpy==0.4.x 07/19 00:30
16F:→ whereweare: 各个相依套件依序装好了... python import 测一下挂了 07/19 00:31
17F:→ whereweare: 跟你开头第一个 Error Message 一样; pip list 看看 07/19 00:32
18F:→ whereweare: scipy 版本到达 1.5.x; 你自己先前查到要版本低些 07/19 00:33
19F:→ whereweare: pip uninstall scipy 然後再 pip install scipy==1.2 07/19 00:34
20F:→ whereweare: 没 error message... python import cvxpy & qcqp OK 07/19 00:34
21F:→ whereweare: 剩下的就再看看你後续程式码是否顺利执行罗 07/19 00:35
22F:→ SHORTHAPPY: 哇~谢谢 你的python版本是多少的啊? 07/19 00:36
23F:→ whereweare: 我是2017装的anaconda3(linux),python是3.6 07/19 00:43