gpt4 book ai didi

pycharm - 在pycharm中导入seaborn

转载 作者:行者123 更新时间:2023-12-04 17:44:51 24 4
gpt4 key购买 nike

我已经将 seaborn 升级到 0.9.0pycharm 似乎不为所动。

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

 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'

感谢任何提示。

最佳答案

这可能是由于 PYTHONPATH 冲突导致的,如果你有一个自定义模块/包与标准库模块/包同名,例如命令

技巧是 PyCharm 和带有 Python 插件的 IntelliJ 将项目根、内容根和源根添加到 PYTHONPATH 因此脚本可能在终端中正常运行但在 IDE 中执行时失败。

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

  • 将内容根添加到 PYTHONPATH
  • 将源代码添加到 PYTHONPATH

或者右击项目树中的相应目录-> Mark Directory as -> Unmark as Sources Root

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

关于pycharm - 在pycharm中导入seaborn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52585934/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com