删除源根目录后,出现致命的Python错误,无法在PyCharm中运行脚本

2024-06-16 09:24:41 发布

您现在位置:Python中文网/ 问答频道 /正文

我删除了源根目录(自己的库),从那时起,我无法使用Pycharm执行.py文件。我试着重新安装PyCharm,但没用。这是发生的错误:

C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\python.exe C:/Users/bruno/Dropbox/PythonProjects/auth_file.py
Error processing line 1 of C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site-packages\matplotlib-3.1.1-py3.7-nspkg.pth:

Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 168, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "C:\Users\bruno\Dropbox\PythonProjects\Libraries\core\types.py", line 12, in <module>
    from typing import Tuple, Union, Mapping, List, NamedTuple
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\typing.py", line 28, in <module>
    import re as stdlib_re  # Avoid confusion with the re we export.
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 122, in <module>
    import enum
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\enum.py", line 2, in <module>
    from types import MappingProxyType, DynamicClassAttribute
ImportError: cannot import name 'MappingProxyType' from 'types' (C:\Users\bruno\Dropbox\PythonProjects\Libraries\core\types.py)

这只是一些避免以下错误的文本:It looks like your post is mostly code; please add some more details.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 579, in <module>
    main()
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 566, in main
    known_paths = addsitepackages(known_paths)
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 349, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\site.py", line 178, in addpackage
    import traceback
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\traceback.py", line 5, in <module>
    import linecache
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\linecache.py", line 11, in <module>
    import tokenize
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\tokenize.py", line 33, in <module>
    import re
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\re.py", line 122, in <module>
    import enum
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\enum.py", line 2, in <module>
    from types import MappingProxyType, DynamicClassAttribute
  File "C:\Users\bruno\Dropbox\PythonProjects\Libraries\core\types.py", line 12, in <module>
    from typing import Tuple, Union, Mapping, List, NamedTuple
  File "C:\Users\bruno\AppData\Local\Programs\Python\Python37-32\lib\typing.py", line 31, in <module>
    from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType
ImportError: cannot import name 'WrapperDescriptorType' from 'types' (C:\Users\bruno\Dropbox\PythonProjects\Libraries\core\types.py)

Process finished with exit code 1

Tags: inpyimportliblocallinesiteusers