【问题标题】:Can't pip install torch无法点安装手电筒
【发布时间】:2020-12-07 16:27:40
【问题描述】:

我尝试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", line 51, 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.

【问题讨论】:

    标签: python installation pip torch stanza


    【解决方案1】:

    我可以看到你有一台 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 都有

    【讨论】:

    • 它已安装,节也已安装。但是现在当我尝试在 stanza 中加载 'en' 模型时,我收到一条错误消息:module 'torch' has no attribute 'tensor'
    • @chocojunkie 这是不同的问题。请更新您的问题或创建另一个问题。
    • @chocojunkie 我找到了this 问题,请检查它是否对您有帮助。
    【解决方案2】:

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

    【讨论】:

    • 这在 2021 年 11 月仍然是正确的。就我而言,一旦我将解释器更改为 python 3.8,一切都很好
    猜你喜欢
    • 2020-03-19
    • 2011-09-12
    • 2021-02-15
    • 1970-01-01
    • 2021-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多