导入错误:无法从“IPython.core.debugger”导入名称“Pdb”

Lin*_*oln 1 ipython python-3.x jupyter-notebook

看来我根本无法使用 Jupyter notebook。我已经尝试卸载并再次安装,但此错误仍然存​​在。

[I 19:33:14.916 NotebookApp] KernelRestarter:重新启动内核(1/5),新的随机端口回溯(最近一次调用):文件“/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework /Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main " main ", mod_spec) File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/ 3.7/lib/python3.7/runpy.py”,第 85 行,在 _run_code exec(code, run_globals) 文件“/usr/local/lib/python3.7/site-packages/ipykernel_launcher.py”,第 15 行,在从ipykernel进口kernelapp为应用程序文件“/usr/local/lib/python3.7/site-packages/ipykernel/ INIT.py", line 2, in from .connect import * File "/usr/local/lib/python3.7/site-packages/ipykernel/connect.py", line 13, in from IPython.core.profiledir import ProfileDir File “/usr/local/lib/python3.7/site-packages/IPython/ INIT.py", line 54, in from .core.application import Application File "/usr/local/lib/python3.7/site-packages/IPython/core/application.py", line 25, in from IPython.core import发布,崩溃处理程序文件“/usr/local/lib/python3.7/site-packages/IPython/core/crashhandler.py”,第 27 行,从 IPython.core 导入 ultratb 文件“/usr/local/lib/python3. 7/site-packages/IPython/core/ultratb.py", line 115, in from IPython.core import debugger File "/usr/local/lib/python3.7/site-packages/IPython/core/debugger.py" ,第 47 行,从 pdb 导入 Pdb 作为 OldPdb 文件“/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pdb.py”,第 76 行,在导入代码文件中“/Users/robot/Dropbox/coding/ytautomator/temp/testing_code/code.py", line 17, in fig, ax = plt.subplots(figsize=(15, 8)) File "/usr/local/lib/python3 .7/site-packages/matplotlib/pyplot.py”,第 1209 行,在子图中 fig = figure(**fig_kw) 文件“/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py” ,第 545 行,图 **kwargs) 文件“/usr/local/lib/python3.7/site-packages/matplotlib/backend_bases.py”,第 3251 行,在 new_figure_manager fig = fig_cls(*args, **kwargs)文件“/usr/local/lib/python3.7/site-packages/matplotlib/figure.py”,第367行,在在子图中 fig = figure(**fig_kw) 文件“/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py”,第 545 行,在图中 **kwargs) 文件“/usr/local/ lib/python3.7/site-packages/matplotlib/backend_bases.py”,第 3251 行,在 new_figure_manager fig = fig_cls(*args, **kwargs) 文件“/usr/local/lib/python3.7/site-packages/ matplotlib/figure.py”,第 367 行,在在子图中 fig = figure(**fig_kw) 文件“/usr/local/lib/python3.7/site-packages/matplotlib/pyplot.py”,第 545 行,在图中 **kwargs) 文件“/usr/local/ lib/python3.7/site-packages/matplotlib/backend_bases.py”,第 3251 行,在 new_figure_manager fig = fig_cls(*args, **kwargs) 文件“/usr/local/lib/python3.7/site-packages/ matplotlib/figure.py”,第 367 行,在init FigureCanvasBase(self) # 设置 self.canvas。文件“/usr/local/lib/python3.7/site-packages/matplotlib/backend_bases.py”,第 1582 行,在init self._fix_ipython_backend2gui() 文件“/usr/local/lib/python3.7/site-packages /matplotlib/backend_bases.py”,第 1609 行,在 _fix_ipython_backend2gui ip = IPython.get_ipython() 文件“/usr/local/lib/python3.7/site-packages/IPython/core/getipython.py”,第 22 行,在get_ipython from IPython.core.interactiveshell import InteractiveShell File "/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 46, in from IPython.core.debugger import Pdb ImportError: cannot从“IPython.core.debugger”(/usr/local/lib/python3.dll)导入名称“Pdb”。

我在 Mac OS 10.14.6 中使用 Python 3.7.4 和 Anaconda

我的 pip 免费如下:

appnope==0.1.0
attrs==19.3.0
backcall==0.1.0
bleach==3.1.0
cycler==0.10.0
decorator==4.4.0
defusedxml==0.6.0
entrypoints==0.3
importlib-metadata==0.23
ipdb==0.12.2
ipykernel==5.1.2
ipython==7.8.0
ipython-genutils==0.2.0
jedi==0.15.1
Jinja2==2.10.3
json5==0.8.5
jsonschema==3.1.1
jupyter-client==5.3.4
jupyter-core==4.6.0
jupyterlab==1.1.4
jupyterlab-server==1.0.6
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==3.1.1
mistune==0.8.4
more-itertools==7.2.0
nbconvert==5.6.0
nbformat==4.4.0
notebook==6.0.1
numpy==1.17.2
pandas==0.25.1
pandocfilters==1.4.2
parso==0.5.1
pexpect==4.7.0
pickleshare==0.7.5
prometheus-client==0.7.1
prompt-toolkit==2.0.10
ptyprocess==0.6.0
Pygments==2.4.2
pyparsing==2.4.2
pyrsistent==0.15.4
python-dateutil==2.8.0
pytz==2019.3
pyzmq==18.1.0
Send2Trash==1.5.0
six==1.12.0
terminado==0.8.2
testpath==0.4.2
tornado==6.0.3
traitlets==4.3.3
wcwidth==0.1.7
webencodings==0.5.1
zipp==0.6.0
Run Code Online (Sandbox Code Playgroud)

如果有人可以提供帮助,我会很高兴

谢谢

小智 8

删除文件code.py夹中的文件。它会导致冲突。