ModuleNotFoundError:在Python3.8上安装pythonnet时没有名为'wheel'的模块

1hdlvixo  于 2023-08-08  发布在  Python
关注(0)|答案(3)|浏览(156)

我在python 3.8中使用pip install pythonnet安装pythonnet。我遇到了这个ModuleNotFoundError: No module named 'wheel'错误。我做了一些研究,我找不到解决这个问题的办法。有没有办法解决这个问题?下面是我得到的错误。
提前感谢!

(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\user165>cd C://Python38

C:\Python38>pip install pythonnet
Collecting pythonnet
  Using cached https://files.pythonhosted.org/packages/4a/0a/5964a5a1fdf207fab8e718edd1f8d3578e0681577fe9abe0d9006f9718c2/pythonnet-2.4.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user165\\AppData\\Local\\Temp\\pip-install-b8so9ms2\\pythonnet\\setup.py'"'"'; __file__='"'"'C:\\Users\\user165\\AppData\\Local\\Temp\\pip-install-b8so9ms2\\pythonnet\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: C:\Users\user165\AppData\Local\Temp\pip-install-b8so9ms2\pythonnet\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user165\AppData\Local\Temp\pip-install-b8so9ms2\pythonnet\setup.py", line 18, in <module>
        from wheel import bdist_wheel
    ModuleNotFoundError: No module named 'wheel'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 19.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Python38>

字符串

drkbr07n

drkbr07n1#

要么在虚拟环境(venv)中工作,这将确保wheel被安装,要么自己显式安装,并使用setuptools:

python -m pip install wheel setuptools

字符串

bd1hkmkf

bd1hkmkf2#

首先尝试安装所有依赖项,例如:通过pip install -r requirements.txt。然后,发出第二个命令pip install pythonnet
这在我的案例中解决了这个问题(Centos7,Python 3.6.8,Python 2.4.0)

jjjwad0x

jjjwad0x3#

当我在虚拟Python环境中遇到同样的错误时,我发现了这个问题。解决方案是在安装实际依赖项之前运行pip install --upgrade pip

相关问题