William_H_25 2023-02-02 11:46 采纳率: 14.3%
浏览 146
已结题

UltralyticsYolov8安装报错

问题遇到的现象和发生背景

终端提示Torch因为subprocess没有安装成功,必须需要Torch才能安装UltralyticsYolo v8
我去网上寻找Torch的源代码并使用

cd Torch
python3 setup.py install

安装Torch
可是系统提示Exception: You tried to install "pytorch". The package named for PyTorch is "torch"

遇到的现象和发生背景

我想在我的MacOSX 13.2上安装安装Ultralytics
Git已经被init

用代码块功能插入代码
pip3 install pytorch
pip3 install torch
pip3 install torch vision
cd Torch
python3 setup.py install
运行结果及详细报错内容
➜  ~ git:(main) pip3 install pytorch
Collecting pytorch
  Using cached pytorch-1.0.2.tar.gz (689 bytes)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pytorch
  Building wheel for pytorch (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/39/stsvvgr94d32v12wspl_45dh0000gn/T/pip-install-99p99nhy/pytorch_a70f6066d2404febba90f55b261b377e/setup.py", line 15, in <module>
          raise Exception(message)
      Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pytorch
  Running setup.py clean for pytorch
Failed to build pytorch
Installing collected packages: pytorch
  Running setup.py install for pytorch ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for pytorch did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/39/stsvvgr94d32v12wspl_45dh0000gn/T/pip-install-99p99nhy/pytorch_a70f6066d2404febba90f55b261b377e/setup.py", line 11, in <module>
          raise Exception(message)
      Exception: You tried to install "pytorch". The package named for PyTorch is "torch"
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pytorch

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Usage:                                                                          
  tail <filename> [-n=<n>] [--encoding=<encoding>] [--no-more]
我的解答思路和尝试过的方法

没有任何方案……

我想要达到的结果

UltralyticsYolo v8安装成功并可以使用

  • 写回答

1条回答 默认 最新

  • 社区专家-Monster-XH 2023-02-02 11:53
    关注

    正确的包名应该是torch,而不是pytorch。安装导致错误的可能。
    应该使用命令pip install torch来安装PyTorch。
    可以使用以下命令来安装 PyTorch:

    pip3 install torch
    pip3 install torchvision
    
    

    请改正安装的名称为 "torch",不是 "pytorch"。安装完PyTorch之后,再尝试安装 UltralyticsYolo v8。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
    1人已打赏

报告相同问题?

问题事件

  • 系统已结题 2月10日
  • 已采纳回答 2月2日
  • 赞助了问题酬金15元 2月2日
  • 创建了问题 2月2日