【问题标题】:Uninstalled wrapt module: Python not working卸载的 wrapt 模块:Python 不工作
【发布时间】:2020-10-21 22:42:12
【问题描述】:

由于wraptModuleNotFoundError,我在安装软件包时遇到了困难,因此我删除并尝试重新安装wrapt。

我运行了一次卸载,然后从一个位置删除了 wrapt。我尝试安装,但已经满足要求,所以我再次卸载了wrapt。请参阅下面的三个命令:

Found existing installation: wrapt 1.12.1
Uninstalling wrapt-1.12.1:
  Would remove:
    c:\users\me\appdata\roaming\python\python38\site-packages\wrapt-1.12.1-py3.8.egg-info
    c:\users\me\appdata\roaming\python\python38\site-packages\wrapt\*
Proceed (y/n)? y
  Successfully uninstalled wrapt-1.12.1
PS C:\Users\me> pip install wrapt
Requirement already satisfied: wrapt in c:\users\me\appdata\local\programs\python\python38\lib\site-packages (1.12.1)
PS C:\Users\me> pip uninstall wrapt
Found existing installation: wrapt 1.12.1
Uninstalling wrapt-1.12.1:
  Would remove:
    c:\users\me\appdata\local\programs\python\python38\lib\site-packages\wrapt-1.12.1.dist-info\*
    c:\users\me\appdata\local\programs\python\python38\lib\site-packages\wrapt\*
Proceed (y/n)? y
  Successfully uninstalled wrapt-1.12.1

我以为我已经准备好从头开始,但没有这样的运气。现在,每当我尝试运行 python 或 pip 时,都会收到以下错误。

Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
  File "c:\users\me\appdata\local\programs\python\python38\lib\site.py", line 580, in <module>
    main()
  File "c:\users\me\appdata\local\programs\python\python38\lib\site.py", line 575, in main
    execusercustomize()
  File "c:\users\me\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\bootstrap.py", line 45, in _execusercustomize
    _register_bootstrap_functions()
  File "c:\users\me\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\bootstrap.py", line 25, in _register_bootstrap_functions
    from . import wrapt_certifi
  File "c:\users\me\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\wrapt_certifi.py", line 3, in <module>
    import wrapt
ModuleNotFoundError: No module named 'wrapt'

我已经尝试找到不使用 pip 的 wrapt 安装,但我没有成功。我还尝试将 Python 从 3.8.1 升级到 3.8.3,这导致了相同的 ModuleNotFoundError。卸载 Python 并再次安装产生了相同的结果。我目前根本无法使用手动安装的 Python 或 pip。

你会推荐什么?

【问题讨论】:

  • 使用我拥有的另一个 python 安装软件包并将安装路径设置为正确的位置是否有意义?

标签: python windows pip modulenotfounderror wrapt


【解决方案1】:

解决方案是使用第二次安装 Python (Anaconda) 来修复损坏的 Python。我的 Anaconda Python 维护了一组单独的已安装包,因此它仍在工作。我打开 Anaconda 提示并运行 (reference):

pip install --target="c:\users\me\appdata\local\programs\python\python38\lib\site-packages" wrapt

这会将wrapt 重新安装到正确的site-packages 文件夹中。我原来的 Python 现在可以工作了。

经验教训:小心 pip 卸载

【讨论】:

    猜你喜欢
    • 2022-12-21
    • 1970-01-01
    • 2011-03-07
    • 1970-01-01
    • 2011-08-23
    • 1970-01-01
    • 2020-04-01
    • 2010-10-01
    相关资源
    最近更新 更多