Почему при инициализации библиотеки выскакивает ошибка в питоне?
Пишу импорты:
import tkinter as tk
from tkinter import messagebox
import matplotlib.pyplot as plt
import numpy as np
На что получаю ошибку:
Traceback (most recent call last):
File "C:\Users\vladragone.DESKTOP-S7C34G6\Desktop\project.py", line 3, in <module>
import matplotlib.pyplot as plt
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 246, in <module>
_check_versions()
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 240, in _check_versions
module = importlib.import_module(modname)
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\kiwisolver\__init__.py", line 8, in <module>
from ._cext import (
ImportError: DLL load failed while importing _cext: Не найден указанный модуль.
Как пофиксить? UPD: При попытке uninstall matplotlib вылезает ошибка:
Successfully uninstalled matplotlib-3.7.1
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\cli\base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\commands\uninstall.py", line 110, in run
uninstall_pathset.commit()
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\req\req_uninstall.py", line 424, in commit
self._moved_paths.commit()
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\req\req_uninstall.py", line 277, in commit
save_dir.cleanup()
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\temp_dir.py", line 173, in cleanup
rmtree(self._path)
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 328, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 408, in __call__
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 364, in iter
raise retry_exc.reraise()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 197, in reraise
raise self.last_attempt.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
raise self._exception
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\tenacity\__init__.py", line 411, in __call__
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_internal\utils\misc.py", line 129, in rmtree
shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler)
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 622, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\vladragone.DESKTOP-S7C34G6\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 620, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Отказано в доступе: 'C:\\Users\\vladragone.DESKTOP-S7C34G6\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\~atplotlib.libs\\msvcp140-e78ebc24b6ffa690be9375aacad743a7.dll'
Источник: Stack Overflow на русском