虚拟环境已安装pytorch,而在pycharm中显示ModuleNotFoundError: No module named 'torch’的解决办法

  1. 在pycharm中运行程序,明明系统和虚拟环境都已经安装pytorch,但是在pycharm显示ModuleNotFoundError: No module named ‘torch’。如下图:
    在这里插入图片描述
    1. 通过File >> setting >> Python Interpreter >> “+” >> 搜索torch >> Install Package 未能成功成功安装,
      在这里插入图片描述

\

  1. 于是想着选择安装了torch的虚拟环境下的python,然后在新建.py中导入torch就可以了。

在这里插入图片描述

记录!

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐