Python-配置PyCharm使用正確的Python解釋器
方法一:使用系統Python解釋器
-
打開PyCharm
-
進入
File→Settings→Project→Python Interpreter -
點擊右側的
Add Interpreter,選擇Add Local Interpreter -
選擇
System Interpreter -
在解釋器路徑中,選擇你安裝PyTorch時使用的Python解釋器
-
通常路徑如:
C:\Users\用戶名\AppData\Local\Programs\Python\PythonXX\python.exe -
或Anaconda路徑:
C:\Users\用戶名\anaconda3\python.exe
-
方法二:使用現有虛擬環境
如果你在虛擬環境中安裝了PyTorch:
-
在
Add Python Interpreter窗口中選擇Existing environment -
找到虛擬環境的Python解釋器,通常在:
-
C:\Users\用戶名\venv\Scripts\python.exe(venv) -
C:\Users\用戶名\anaconda3\envs\環境名\python.exe(conda)
-
本文來自博客園,作者:業余磚家,轉載請注明原文鏈接:http://www.rzrgm.cn/yeyuzhuanjia/p/19157889

浙公網安備 33010602011771號