---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 2
1 # First, import PyTorch
----> 2 import torch
ModuleNotFoundError: No module named 'torch'
从命令行我看到的 -
>>> import torch
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
import torch
ModuleNotFoundError: No module named 'torch'
由于您不使用环境,首先激活环境,然后打开jupyter实验室,然后验证pytorch
对于M1/M2 Mac,使用Pytorch的Apple Silicon版本 在同一虚拟环境中安装jupyter
pip install jupyterlab
Kernel Configuration
装置ipykernel以使虚拟环境在jupyter中可用 bash
在启动Jupyter Lab之前,请访问您的虚拟环境,以确保可见的包裹可见性。