无法点安装割炬

问题描述

我正尝试pip install stanza并收到此消息:

ERROR: No matching distribution found for torch>=1.3.0 (from stanza)

然后我运行pip install torch并获得了以下内容(该网站不允许我包含太多代码,因此here's the full error

  ERROR: Command errored out with exit status 1:
   command: 'c:\python\python37\python.exe' ... ...
  ...  ...
  Traceback (most recent call last):
    ... ...
    File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch\setup.py",line 51,in run
      from tools.nnwrap import generate_wrappers as generate_nn_wrappers
  ModuleNotFoundError: No module named 'tools.nnwrap'
  ----------------------------------------
  ERROR: Failed building wheel for torch
  ERROR: Command errored out with exit status 1:
   command: 'c:\python\python37\python.exe' ... ...
       cwd: C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch
  Complete output (2 lines):
  running clean
  error: [Errno 2] No such file or directory: '.gitignore'
  ----------------------------------------
  ERROR: Failed cleaning build dir for torch
DEPRECATION: Could not build wheels for torch which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python37\python.exe' ... ...
    Traceback (most recent call last):
    ... ...
      File "C:\Users\borka\AppData\Local\Temp\pip-install-10i7vgad\torch\setup.py",in run
        from tools.nnwrap import generate_wrappers as generate_nn_wrappers
    ModuleNotFoundError: No module named 'tools.nnwrap'
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python37\python.exe' ... ... Check the logs for full command output.

解决方法

我可以看到您有一台Windows计算机,因此可以从this official pytorch网站上构建最适合您的要求和系统的命令,请尝试

pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

还有here,所有torch软件包都位于Windows,MacOS和Linux上

,

我遇到了同样的错误,并意识到Pytorch还不支持Python 3.9。我使用Python 3.7创建了另一个虚拟环境,安装成功了。