今天在运行scipy的时候,出现了下面的错误:

➜  a1 python starting_script.py --random
Traceback (most recent call last):
File "starting_script.py", line 9, in <module>
from scipy.stats import norm, loguniform
ImportError: cannot import name 'loguniform' from 'scipy.stats

我的scipy版本是1.3, python3.7

解决方法

pip install scipy --upgrade

输出的日志是:

Looking in indexes: http://pip.baidu.com/root/baidu/+simple/
Collecting scipy
Downloading http://pip.baidu.com/root/baidu/packages/packages/85/64/5dbe0daf0beb14c3cd4b9a3493c5dc1fda68d13ad3fe0b173be8032e3172/scipy-1.7.3-cp37-cp37m-macosx_10_9_x86_64.whl (33.0MB)

参考文献

​How to resolve error importing stats.scipy.loguniform​