python - 致命的 Python 错误 - 删除源根目录后无法在 PyCharm 中运行脚本
问题描述
我删除了源根目录(自己的库),从那时起,我无法使用 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
解决方案
我认为这是一个 Python 问题,不是吗?您是否尝试重新安装python?
推荐阅读
- windows - 如何杀死进程在Windows中每隔一秒重复一次?
- git - git checkout HEAD -- 之间有区别吗?和 git reset --hard HEAD?
- python - 合并两个排序列表返回运行时错误
- java - 为什么在 Android Studio 上找不到小程序?
- c - 我的第一个程序的几个小问题
- sql - 在 SQL Server 动态数据透视中分配默认值
- mysql - 为什么 mysql-client 不能通过 docker-forwarded tcp 端口连接到 GCP cloud_sql_proxy?
- r - 设置条件 group_by
- validation - 在不是 TextFormField 的颤动中验证属性的值
- c++ - C++ PlaySound() 给出错误