Error processing line 1 of D:\Anaconda\envs\Train\lib\site-packages\matplotlib-3.7.1-py3.9-nspkg.pth: Fatal Python error: init_import_site: Failed to import the site module Python runtime state: initialized Traceback (most recent call last): File "D:\Anaconda\envs\Train\lib\site.py", line 169, in addpackage exec(line) File "<string>", line 1, in <module> File "D:\Anaconda\envs\Train\lib\importlib\util.py", line 2, in <module> from . import abc File "D:\Anaconda\envs\Train\lib\importlib\abc.py", line 17, in <module> from typing import Protocol, runtime_checkable File "D:\Anaconda\envs\Train\lib\typing.py", line 26, in <module> import re as stdlib_re # Avoid confusion with the re we export. File "E:\fin\re.py", line 2, in <module> from repair import Ui_MainWindow File "E:\fin\repair.py", line 11, in <module> from PyQt5 import QtCore, QtGui, QtWidgets File "D:\Anaconda\envs\Train\lib\site-packages\PyQt5\__init__.py", line 20, in <module> __path__ = __import__('pkgutil').extend_path(__path__, __name__) File "D:\Anaconda\envs\Train\lib\pkgutil.py", line 643, in <module> _NAME_PATTERN = re.compile(f'^(?P<pkg>{_DOTTED_WORDS})(?P<cln>:(?P<obj>{_DOTTED_WORDS})?)?$', re.U) AttributeError: partially initialized module 're' has no attribute 'compile' (most likely due to a circular import) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Anaconda\envs\Train\lib\site.py", line 589, in <module> main() File "D:\Anaconda\envs\Train\lib\site.py", line 576, in main known_paths = addsitepackages(known_paths) File "D:\Anaconda\envs\Train\lib\site.py", line 359, in addsitepackages addsitedir(sitedir, known_paths) File "D:\Anaconda\envs\Train\lib\site.py", line 208, in addsitedir addpackage(sitedir, name, known_paths) File "D:\Anaconda\envs\Train\lib\site.py", line 179, in addpackage import traceback File "D:\Anaconda\envs\Train\lib\traceback.py", line 5, in <module> import linecache File "D:\Anaconda\envs\Train\lib\linecache.py", line 11, in <module> import tokenize File "D:\Anaconda\envs\Train\lib\tokenize.py", line 32, in <module> import re File "E:\fin\re.py", line 2, in <module> from repair import Ui_MainWindow File "E:\fin\repair.py", line 11, in <module> from PyQt5 import QtCore, QtGui, QtWidgets File "D:\Anaconda\envs\Train\lib\site-packages\PyQt5\__init__.py", line 20, in <module> __path__ = __import__('pkgutil').extend_path(__path__, __name__) File "D:\Anaconda\envs\Train\lib\pkgutil.py", line 6, in <module> import importlib.util File "D:\Anaconda\envs\Train\lib\importlib\util.py", line 2, in <module> from . import abc File "D:\Anaconda\envs\Train\lib\importlib\abc.py", line 17, in <module> from typing import Protocol, runtime_checkable File "D:\Anaconda\envs\Train\lib\typing.py", line 2245, in <module> Pattern = _alias(stdlib_re.Pattern, 1) AttributeError: partially initialized module 're' has no attribute 'Pattern' (most likely due to a circular import)
时间: 2023-06-16 15:02:02 浏览: 331
最详细的机器学习环境的搭建和使用—-anaconda/jupyter/tensorflow-gpu /opencv等 安装和常用使用方法总结
这个错误看起来是由于 circular import(循环导入)引起的。可能的解决方法是:
1. 检查你的代码中是否存在循环导入的问题。循环导入是指两个或多个模块之间的相互导入,可能会导致类似于你遇到的这种错误。
2. 检查你的环境中是否有重复命名的模块或包。如果有,尝试删除或重命名它们。
3. 尝试更新或重新安装受影响的包,例如 matplotlib 和 PyQt5。
希望这些方法可以帮助你解决问题。
阅读全文