美文网首页大数据 爬虫Python AI Sql
python 包名冲突 ImportError: cannot

python 包名冲突 ImportError: cannot

作者: 盖码范 | 来源:发表于2019-08-22 15:38 被阅读1次

    错误信息:

    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

    查找问题

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


    image.png

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

    image.png

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


    image.png

    结果

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

    相关文章

      网友评论

        本文标题:python 包名冲突 ImportError: cannot

        本文链接:https://www.haomeiwen.com/subject/xbwnsctx.html