问题:
按照b站一些up主的方法来安装,结果运行时却告诉我:报错ModuleNotFoundError: No module named ‘torch‘ 可是我明明已经装了torch
安装教程参考的是(https://www.bilibili.com/video/BV1o3411V7Zz/?spm_id_from=333.880.my_history.page.click&vd_source=ad813e1004be679f01f964a5bda10dd8)
解决:
后来看了一些人的经验,总算没再有这个问题,解决如下:文章来源:https://www.toymoban.com/news/detail-449804.html
- 按照上面那个教程按照anaconda,注意一定要 install for just me!just me!just me! 这样之后才会有 自己添加路径不用人为添加的选项,操作会简单些。
- 按照该up主在base里建了其他环境并在里面安装,但结果是No module named ‘torch‘ ,于是后来在base里直接复制粘贴清华源,然后把pytorch网站上响应的语句复制粘贴,最后成功
- `conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
conda config --set show_channel_urls yes
`
我用了cpu文章来源地址https://www.toymoban.com/news/detail-449804.html
到了这里,关于解决pytorch明明已经安装好了但是import时报错ModuleNotFoundError: No module named ‘torch‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!