pycharm remote connection, remote environment configuration, virtual environment configuration
The purpose of writing this article
I found that many tutorials are actually biased towards people with foundation. For those who have no foundation at all, the omission of some small steps is difficult to cross the gap. Therefore, I want to write a configuration process suitable for Xiaobai.
Creation of virtual environment
If we want to connect to the server remotely on pycharm, we must first create a virtual environment, which we can use xshell to operate. (You can download it yourself, no resources are provided here)
-
Open xshell to connect to the server, click on the file in the upper left corner, create a new one
, and then fill in the password next and you will be connected. -
After connecting, start to download anaconda, just enter wget
https://repo.continuum.io/archive/Anaconda3-2021.05-Linux-x86_64.s -
After the input is complete, enter bash Anaconda3-2021.05-Linux-x86_64.sh and press Enter. If you need to enter yes or no, enter yes
-
After the installation is complete, enter conda info to see if there is any information displayed. If so, congratulations on your successful installation
-
If there is no (note that this means that there is no, some do not proceed to this step!!!), enter vim ~/.bashrc and press the I key (yes, that is the English letter I on the keyboard) to enter the edit mode, and then the last line Add export PATH=/home/XXX/anaconda3/bin:$PATH (this XXX is the name you logged in, if you don’t know, you can also enter pwd to see your current address), press esc to exit the modification mode after modification, Then enter: w to save, enter: q to exit (don’t miss the colon), then enter source ~/.bashrc to update the file, and finally enter conda info to see the information
-
Congratulations, you have finished installing anaconda. Next, we need to look at the default address of the virtual environment. Generally speaking, it should be under anaconda/envs, but some default addresses are under .conda/envs. Also enter conda info to see where the envs_dirs virtual environment address is. If it is under anaconda, don’t worry about it. In .conda If not, we have to continue the Long March.
-
We can enter conda config --add envs_dirs /home/xxx/anaconda3/envs to specify the location of the virtual environment (I am anaconda3, you can see what is there, you can enter ls to see what folders are there)
-
After the okk change is successful, start to create our virtual environment, enter conda create -n xxx python=3.8 (xxx is what your virtual environment wants to be called, 3.8 is what I want 3.8, you can choose as much as you want)
-
If you should enter yes, you should enter yes. If the creation process is very slow, you can try to change the source. As for how to change the source, you can see this address https://cloud.tencent.com/developer/article/1572996 (don’t rush Look, one step here is to find the .condarc file. The method is to enter vim .condarc and then press I to enter the edit mode. After editing, ESC exits the edit mode. Enter: w to save, enter ; q to exit and the colon cannot be lost) After everything is done, you can create it again
-
Then your environment is successfully created, and then you enter your environment, enter conda activate xxx (xxx is your own name, don’t forget)
-
After entering, you can download pytorch (As for which version of pytorch to download, this is not what I want to teach in this tutorial, you can check hhh yourself, well, you can also enter nvidia-smi to see your cuda version, and then Go to check the corresponding pytorch), anyway, I input conda install pytorch== 1.11.0 torchvision== 0.12.0 torchaudio==0.11.0 cudatoolkit=10.2 -c pytorch (note to remove the space after ==, here I Separated for formatting)
-
If it fails very slowly, the old rules continue to change the source https://blog.csdn.net/weixin_44413191/article/details/107849696 to see this tutorial, this does not need to go into detail.
-
We have done the basics, start to open your dear pycharm
pycharm connects to the server remotely
- Select file and click settings
- Not much to say, as shown in the figure
- select add
- Fill in IP, fill in name
- Enter the password, and then the next step
6.
6. Select the virtual environment, the first blurred place is your login name, and the second is the name of your virtual environment
7. Select the mapping address. It is best to create a folder by yourself. For example, if I have another project called test, then I can create a folder called demo, and create a folder called test in the demo. As shown in the figure, the login name is
8, finish, and then click what to click
9, perfect
10. Turn on the automatic update, and you can also turn on the SSH connection, so that you can operate the server in the terminal
OKK After finishing the sprinkling of flowers, the pictures that have not been patched will be patched up later depending on the mood.
Thanks to my roommate for teaching me who is completely novice, I have read all the tutorials but I can't do it for a long time, and I can't even ask where the problem is. I hope you can successfully configure your own environment!