实际安装模块时,在pip安装期间出现ModuleNotFoundError

时间:2020-07-01 15:32:35

标签: python pip modulenotfounderror wrapt

我尝试使用pip install bentoml安装python软件包(BentoML),但收到以下错误,错误为ModuleNotFoundError: No module named 'wrapt'。但是,wrapt模块实际上包含在我的site-packages文件夹中,因此,pip install wrapt会提示我已经安装了wrapt

我可以使用pip安装其他软件包,但是alembic软件包会导致此问题。我可以使用Anaconda Python使用pip进行安装,但是我希望它与此Python版本一起安装。最好的前进方向是什么?

我正在Windows 10设备上使用Python 3.8.1。

  ERROR: Command errored out with exit status 1:
   command: 'c:\users\username\appdata\local\programs\python\python38\python.exe' 'c:\users\username\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\user~1.lastname\AppData\Local\Temp\tmpd30adik_'
       cwd: C:\Users\username\AppData\Local\Temp\pip-install-qers2adl\alembic
  Complete output (14 lines):
  Fatal Python error: init_import_size: Failed to import the site module
  Python runtime state: initialized
  Traceback (most recent call last):
    File "c:\users\username\appdata\local\programs\python\python38\lib\site.py", line 580, in <module>
      main()
    File "c:\users\username\appdata\local\programs\python\python38\lib\site.py", line 573, in main
      execsitecustomize()
    File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\bootstrap.py", line 37, in _execsitecustomize
      _register_bootstrap_functions()
    File "c:\users\username\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\username\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\wrapt_certifi.py", line 3, in <module>
      import wrapt
  ModuleNotFoundError: No module named 'wrapt'
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\username\appdata\local\programs\python\python38\python.exe' 'c:\users\username\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\user~1.lastname\AppData\Local\Temp\tmpd30adik_' Check the logs for full command output.

1 个答案:

答案 0 :(得分:0)

使用其他版本的Python安装。打开Anaconda提示符(或同一设备上的其他版本的Python),然后运行:

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

这与我尝试卸载/重新安装wrapt后破坏Python时使用的方法相同。其他Python版本会将Alembic安装到正确的位置,并且原始安装有效。