无法导入火炬

问题描述 投票:0回答:1

我使用

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia 
安装火炬,当我尝试导入它时,我看到错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Anacondat Path\envs\EnvName\Lib\site-packages\torch\__init__.py", line 137, in <module>
    raise err
OSError: [WinError 127] The specified procedure could not be found. Error loading "Anacondat Path\envs\EnvName\Lib\site-packages\torch\lib\c10_cuda.dll" or one of its dependencies.
pytorch anaconda conda torch
1个回答
0
投票

如果您使用的是 CPU,请激活 conda 环境并运行:

pip3 install torch torchvision torchaudio

如果您在 GPU 上运行:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
© www.soinside.com 2019 - 2024. All rights reserved.