python 包名冲突 ImportError: cannot import name 'InteractiveInterpreter'

错误信息:

Traceback (most recent call last):
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 2, in <module>
    from _pydevd_bundle_ext.pydevd_cython import trace_dispatch, PyDBAdditionalThreadInfo, global_cache_skips, global_cache_frame_skips
ModuleNotFoundError: No module named '_pydevd_bundle_ext'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info.py", line 17, in <module>
    from _pydevd_bundle.pydevd_cython_wrapper import PyDBAdditionalThreadInfo
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_cython_wrapper.py", line 32, in <module>
    mod = __import__(check_name)
  File "_pydevd_bundle\pydevd_cython_win32_36_64.pyx", line 139, in init _pydevd_bundle.pydevd_cython_win32_36_64
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_breakpoints.py", line 16, in <module>
    from _pydevd_bundle.pydevd_comm import get_global_debugger
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 80, in <module>
    from _pydevd_bundle import pydevd_console_integration
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py", line 11, in <module>
    from code import InteractiveInterpreter, InteractiveConsole
ImportError: cannot import name 'InteractiveInterpreter'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\pydevd.py", line 28, in <module>
<module 'code' from 'D:\\Desktop\\代码\\code.py'>
    from _pydevd_bundle.pydevd_additional_thread_info import PyDBAdditionalThreadInfo
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info.py", line 19, in <module>
    from _pydevd_bundle.pydevd_additional_thread_info_regular import PyDBAdditionalThreadInfo  # @UnusedImport
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 7, in <module>
    from _pydevd_bundle.pydevd_frame import PyDBFrame
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_frame.py", line 10, in <module>
    from _pydevd_bundle.pydevd_breakpoints import get_exception_breakpoint
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_breakpoints.py", line 16, in <module>
    from _pydevd_bundle.pydevd_comm import get_global_debugger
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_comm.py", line 80, in <module>
    from _pydevd_bundle import pydevd_console_integration
  File "E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py", line 11, in <module>
    from code import InteractiveInterpreter, InteractiveConsole
ImportError: cannot import name 'InteractiveInterpreter'

提示不要导入包InteractiveInterpreter

查找问题

第一步, 先在终端导入,导入正常,没有报错。


14530364-e2592f974719e6f3.png
image.png

第二步,跳转到上面代码导入报错的位置:"E:\Program Files\PyCharm 2019.1.1\helpers\pydev\_pydevd_bundle\pydevd_console_integration.py"

14530364-dc6cf0a33dfc8cc1.png
image.png

看打印结果,发现导入的是我自己写的一个code。


14530364-04a3cc10338994d2.png
image.png

结果

删除我自己创建的code.py文件,就不会跟包文件冲突了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值