我正在尝试运行PyCharm分析器,但收到以下错误消息:
Traceback (most recent call last):
File "/home/b3053674/ProgramFiles/pycharm-2017.1.4/helpers/profiler/run_profiler.py", line 164, in <module>
profiler.run(file)
File "/home/b3053674/ProgramFiles/pycharm-2017.1.4/helpers/profiler/run_profiler.py", line 89, in run
execfile(file, globals, globals) # execute the script
File "/home/b3053674/Documents/pycotools/pycotools/tasks.py", line 38, in <module>
import viz,errors, misc, _base, model
File "/home/b3053674/Documents/pycotools/pycotools/viz.py", line 53, in <module>
import matplotlib.pyplot as plt
File "/home/b3053674/anaconda2/envs/pycotools/lib/python2.7/site-packages/matplotlib/__init__.py", line 124, in <module>
from . import cbook
ImportError: cannot import name cbook
Snapshot saved to /home/b3053674/.PyCharm2017.1/system/snapshots/pycotools30.pstat
Process finished with exit code 1我使用的是conda环境,我已经在终端中切换到该环境:
$ source activate <env>然后更新matplotlib
$pip install matplotlib --upgrade六个只是为了更好的衡量
$pip install six --upgrade(请注意,我还手动从我的环境的站点目录中删除了这些包,并重新安装了,以防--upgrade不正常)
我还切换了PyCharm Run配置,以依次使用我的每个conda环境,所有这些环境都会产生相同的错误。
请注意,分析器以前已经工作过了,当我使用正常的方式执行代码时,代码工作得很好。有人知道这是怎么回事吗?
谢谢
发布于 2017-10-25 07:20:06
我今天遇到了同样的错误,尽管可能是由于不同的原因- matplotlib和/或six的包似乎被损坏了。
通过降级到以前的版本解决了这个问题:
conda install six=1.10.0
conda install matplotlib=2.0.2发布于 2019-03-27 15:31:02
我也有同样的问题。降级到matplotlib 2.0.2似乎可以解决这个问题。
pip uninstall matplotlib
pip install matplotlib==2.0.2发布于 2017-12-29 01:46:21
我在jupyter中有这个错误,但在IPython中没有。修复了上面的$ conda install matplotlib=2.0.2,但有六个没有降级。不要忘记(和我一样)重新启动内核。
https://stackoverflow.com/questions/46651581
复制相似问题