我已经将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'任何小费都会得到赏识。
发布于 2018-10-04 08:57:23
如果您有一个与标准库模块/包同名的自定义模块/包,例如PYTHONPATH,这可能是由于cmd冲突造成的。
诀窍是PyCharm和IntelliJ与Python一起向PYTHONPATH添加项目根、内容根和源根,因此脚本可能在终端中正确工作,但在PYTHONPATH中执行时失败。
若要禁用内容和源根的此行为,请转到专用运行配置和取消选中选项。
或右击项目树->标记目录中的相应目录,将->取消标记为源根。
内容根可以在设置\项目.\项目结构中进行管理。
https://stackoverflow.com/questions/52585934
复制相似问题