I installed the CPU version of pytorch. When configuring the conda environment in Pycharm, it is not displayed every time I add it. I searched many methods to no avail. Finally, it was successfully solved. Here are some methods to summarize, so that everyone can solve the problem.
my situation and solution
problem and display
1. In Pycharm's log environment idea.log (C:\Users\Deadl\AppData\Local\JetBrains\PyCharmCE2023.1\log), there is such a message 2. After restarting pycharm
several times, it shows that the execution permission is not enough (This is also what I have never had before)
CondaError: Unable to create prefix directory ‘E:\Anaconda3\envs…’.Check that you have sufficient permissions.
Solution
Enter Pycharm with administrator privileges, he automatically recognizes the unadded environment, and successfully configures conda
overall solution
1. Make sure the Anaconda environment variables are configured correctly
If you checked the add path when installing Anaconda, it is usually configured
Make sure pytorch is installed successfully
Open Anaconda Prompt and enter the created pytorch environment
activete PyTorch(创建的pytorch环境名称,我的是PyTorch)
Check if the installation is successful
python
import torch
print(torch.__version__)
Method 1: Change the system interpreter
Applicable to the case where the same error is reported in the log.
After the update is successful, add the conda interpreter
Method Two:
Pycharm can't find the conda environment correctly.
Refer to the answer and solution of this big guy, link link