赞
踩
- import torch
- a = torch.cuda.is_available()
- print(a)
- Traceback (most recent call last):
- File "D:\File\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3457, in run_code
- exec(code_obj, self.user_global_ns, self.user_ns)
- File "<ipython-input-2-191f6205abea>", line 1, in <module>
- runfile('D:\\File\\Pycharm\\Projects\\pythonProject1\\main.py', wdir='D:\\File\\Pycharm\\Projects\\pythonProject1')
- File "D:\File\Pycharm\PyCharm 2024.1.4\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
- pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
- File "D:\File\Pycharm\PyCharm 2024.1.4\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
- exec(compile(contents+"\n", file, 'exec'), glob, loc)
- File "D:\File\Pycharm\Projects\pythonProject1\main.py", line 1, in <module>
- import torch
- File "D:\File\Pycharm\PyCharm 2024.1.4\plugins\python\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
- module = self._system_import(name, *args, **kwargs)
- ModuleNotFoundError: No module named 'torch'
这里是创建文件时路径问题
conda env list
以下情况表示配置成功
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。