繁体   English   中英

使用PyCharm的Profiler时,“ImportError:无法导入名称cbook”

[英]'ImportError: cannot import name cbook' when using PyCharm's Profiler

我试图运行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

(请注意,我还手动从我的环境的site-directory中删除了这些包,并重新安装只是incase --upgrade没有表现)

我看过这里这里 ,两个解决方案都没有解决我的问题。

我还将PyCharm Run配置切换为使用我的每个conda环境,所有这些环境都会产生相同的错误。

请注意,在我使用常规执行代码的方法之前,探查器在以前工作过,并且代码工作正常。 有没有人知道发生了什么?

谢谢

我今天遇到了同样的错误,虽然可能是出于不同的原因 - matplotlib和/或6的包似乎被打破了。

通过降级到以前的版本来解决它:

conda install six=1.10.0
conda install matplotlib=2.0.2

我在jupyter中有这个错误但不是IPython。 使用$ conda install matplotlib=2.0.2修复如上,但六个未降级。 不要忘记(正如我所做的)重启内核。

我遇到过同样的问题。 降级到matplotlib 2.0.2似乎解决了这个问题。

pip uninstall matplotlib
pip install matplotlib==2.0.2

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM