卸载的 wrapt 模块:Python 不工作 [英] Uninstalled wrapt module: Python not working

查看:35
本文介绍了卸载的 wrapt 模块:Python 不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于 wraptModuleNotFoundError,我在安装包时遇到困难,所以我删除并尝试重新安装 wrapt.

I was having difficulty installing a package because of a ModuleNotFoundError for wrapt and so I removed and tried to reinstall wrapt.

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

I ran the uninstall once, and wrapt was removed from one location. I tried to install, but the requirement was already satisfied, so I uninstalled wrapt again. See the three commands below:

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 时,都会收到以下错误.

I thought I was all ready to start with a clean slate, but no such luck. Now I receive the following error whenever I try to run python or 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.

I've tried finding installation for wrapt that does not use pip, but I haven't been successful. I also attempted upgrading Python from 3.8.1 to 3.8.3, which resulted in the same ModuleNotFoundError. Uninstalling Python and installing again yielded the same result. I currently cannot use my manually installed Python or pip at all.

你会推荐什么?

推荐答案

解决方案是使用 Python (Anaconda) 的第二个安装来修复我损坏的 Python.我的 Anaconda Python 维护着一组单独的安装包,所以它仍然可以工作.我打开了一个 Anaconda 提示并运行(参考):

The solution was to use a second installation of Python (Anaconda) to fix my broken Python. My Anaconda Python maintains a separate set of installed packages, so it was still working. I opened an Anaconda prompt and ran (reference):

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

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

This reinstalled wrapt in the correct site-packages folder. My original Python is now working.

经验教训:小心点卸载

这篇关于卸载的 wrapt 模块:Python 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆