Pycharm 在皮查姆进口seaborn

Pycharm 在皮查姆进口seaborn,pycharm,Pycharm,我已经将seaborn升级到0.9.0,pycharm似乎没有什么印象 在命令行上运行的脚本无法继续执行: import seaborn as sns 将抛出以下命令: Traceback (most recent call last): File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1664, in <module> main() File "/Applica

我已经将
seaborn
升级到
0.9.0
pycharm
似乎没有什么印象

在命令行上运行的脚本无法继续执行:

 import seaborn as sns
将抛出以下命令:

Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1664, in <module>
    main()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/git/uni/_psl/proj1/myMain.py", line 202, in <module>
    import seaborn as sns
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/seaborn/__init__.py", line 17, in <module>
    from .widgets import *
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/seaborn/widgets.py", line 8, in <module>
    from ipywidgets import interact, FloatSlider, IntSlider
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/ipywidgets/__init__.py", line 23, in <module>
    from IPython import get_ipython
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/IPython/__init__.py", line 54, in <module>
    from .core.application import Application
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/IPython/core/crashhandler.py", line 27, in <module>
    from IPython.core import ultratb
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/IPython/core/ultratb.py", line 115, in <module>
    from IPython.core import debugger
  File "/Users/sboesch/Library/Python/3.6/lib/python/site-packages/IPython/core/debugger.py", line 46, in <module>
    from pdb import Pdb as OldPdb
  File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pdb.py", line 136, in <module>
    class Pdb(bdb.Bdb, cmd.Cmd):
AttributeError: module 'cmd' has no attribute 'Cmd'
回溯(最近一次呼叫最后一次):
文件“/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev.py”,第1664行,在
main()
文件“/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev.py”,第1658行,主目录
globals=debugger.run(setup['file'],None,None,is_模块)
文件“/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py”,第1068行,运行中
pydev_imports.execfile(文件、全局、局部)#执行脚本
文件“/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py”,execfile中第18行
exec(编译(内容+“\n”,文件,'exec'),全局,loc)
文件“/git/uni/_psl/proj1/myMain.py”,第202行,在
导入seaborn作为sns
文件“/usr/local/cillar/python/3.6.4_4/Frameworks/python.framework/Versions/3.6/lib/python3.6/site packages/seaborn/__init___;.py”,第17行
从.widgets导入*
文件“/usr/local/ceral/python/3.6.4_4/Frameworks/python.framework/Versions/3.6/lib/python3.6/site packages/seaborn/widgets.py”,第8行
从ipywidgets导入interact、FloatSlider、IntSlider
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site-packages/ipywidgets/_-init___.py”,第23行,在
从IPython导入获取
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site-packages/IPython/_-init___u;.py”,第54行,在
from.core.application导入应用程序
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site-packages/IPython/core/application.py”,第25行,在
从IPython.core导入版本,crashhandler
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site packages/IPython/core/crashhandler.py”,第27行,在
从IPython.core导入ultratb
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site-packages/IPython/core/ultratb.py”,第115行,在
从IPython.core导入调试器
文件“/Users/sboesch/Library/Python/3.6/lib/Python/site-packages/IPython/core/debugger.py”,第46行,在
从pdb将pdb作为旧pdb导入
文件“/usr/local/ceral/python/3.6.4_4/Frameworks/python.framework/Versions/3.6/lib/python3.6/pdb.py”,第136行,在
类Pdb(bdb.bdb,cmd.cmd):
AttributeError:模块“cmd”没有属性“cmd”

欢迎提供任何提示。

如果您有与标准库模块/包同名的自定义模块/包,例如
cmd
,则这可能是由于
PYTHONPATH
冲突造成的

诀窍是PyCharm和IntelliJ与Python插件将项目根、内容根和源根添加到
PYTHONPATH
中,这样脚本可以在终端中正常工作,但在IDE中执行时失败

要对内容和源根目录禁用此行为,请转到专用运行配置并取消选中选项

  • 将内容根添加到PYTHONPATH
  • 将源根添加到PYTHONPATH
或者右键单击项目树中相应的目录->将目录标记为->取消标记为源根目录


内容根目录可以在设置|项目…|中管理项目结构

项目中是否有自定义模块/包
cmd
?它可以是一个
PYTHONPATH
collision.oh!在项目的另一部分的一个旧文件夹中有一个
cmd.py
。看起来像是
Intellij
找到了那个旧文件夹。我没想到IJ会找到整个项目中的所有文件夹并将它们添加到
PYTHONPATH
。请回答。