我只是想为我的项目导入 pytorch 但我收到此错误
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Roaming\Python\Python312\site-packages\torch\__init__.py", line 141, in <module>
raise err
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\User\AppData\Roaming\Python\Python312\site-packages\torch\lib\shm.dll" or one of its dependencies.
我检查了该文件夹,shm.dll 文件确实存在。
我也重新安装了模块,但还是一样
这就是我安装 pytorch 的方式
pip3 install torch torchvision torchaudio
编辑:我通过将 \AppData\Roaming\Python\Library 添加到 PATH 来解决它