2024-10-04 07:35:51 发布
网友
我正在尝试安装torchaudio以便在Jupyter笔记本中使用,但当我导入它时,出现错误:
torchaudio
ModuleNotFoundError: No module named 'torchaudio'
我试图将它导入笔记本使用的.py文件中,但没有成功。我想它可能没有正确安装,但当我尝试使用pip install torchaudio安装它时,我得到了“需求已经满足”
.py
pip install torchaudio
我迷路了,如何才能成功导入
检查您的虚拟环境(安装torchaudio的地方)是否安装了jupyter。如果没有,很可能是从根环境启动jupyter,因此jupyter正在使用根环境(没有安装torchaudio)
这是一个非常常见的错误。您可以通过在安装了torchaudio的环境中安装jupyter并从那里启动jupyter来解决这个问题
通过运行以下命令,您始终可以检查正在启动的jupyter:
which jupyter
应返回:
Collecting torchaudio Downloading https://files.pythonhosted.org/packages/96/34/c651430dea231e382ddf2eb5773239bf4885d9528f640a4ef39b12894cb8/torchaudio-0.6.0-cp36-cp36m-manylinux1_x86_64.whl (6.7MB) |████████████████████████████████| 6.7MB 2.4MB/s Requirement already satisfied: torch==1.6.0 in /usr/local/lib/python3.6/dist-packages (from torchaudio) (1.6.0+cu101) Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from torch==1.6.0->torchaudio) (0.16.0) Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from torch==1.6.0->torchaudio) (1.18.5) Installing collected packages: torchaudio Successfully installed torchaudio-0.6.0
一切都应该按预期进行
检查您的虚拟环境(安装torchaudio的地方)是否安装了jupyter。如果没有,很可能是从根环境启动jupyter,因此jupyter正在使用根环境(没有安装torchaudio)
这是一个非常常见的错误。您可以通过在安装了torchaudio的环境中安装jupyter并从那里启动jupyter来解决这个问题
通过运行以下命令,您始终可以检查正在启动的jupyter:
应返回:
一切都应该按预期进行
相关问题 更多 >
编程相关推荐