Table of contents
Preface
首先需要你已经拥有一台远程服务器:
- Remote linux server: 123.23.45.6:12345
- Username:zzc
- Password: 111111
- Conda has been installed (anaconda/miniconda)
- local windows server
- Pycharm is in place
- You can log in to the server via ssh
1. Create a conda environment (remote)
① Log in to the remote client and open the local powershell
ssh -p 12345 -L8888:localhost:8888 [email protected]
- The port is mapped directly here, and the remote jupyter notebook can be opened in the local browser (it doesn't matter if it is not mapped)
② Create an environment named gnn, the python version is 3.8, and install pip and jupyter notebook at the same time
conda create -n gnn python=3.8 pip jupyter
③ Activate the environment
conda activate gnn
④ Environmental resources required for installation
!pip install numpy pandas matplotlib tqdm networkx -i https://pypi.tuna.tsinghua.edu.cn/simple
Server-side configuration is basically completed
2. Configuration of local Pycharm
1. Create a new project: remote
① Open pycharm and create a new project
② Configure the remote development environment
1) Select the path>>> Select "Add Interpreter" >>> SSH...
2) Select "New" >>> ; Fill in the host IP and port number>>> Fill in the user name>>> Next step
A password is required for the first connection>>> Introspection completed, Click Next
3) Select the system interpreter>>> Click the three dots on the right to find your own defined environment
Your conda installation Location/envs/environment name/bin/python
4) After the interpreter is configured, click Create to complete the project creation
Wait for the interpreter to update (it will take a few minutes )
③ Test the remote development environment
Create a new jupyter notebook file
The reference is successful and the remote environment configuration is completed
2. Synchronize project directory
① In the project menu, select Tools>>> Deployment>>> Configuration
② In the pop-up window, click ➕ >>> Select SFTP > >> Give a name
③ Select the ssh you just created >>> After passing the test, select the project folder on the remote server>>> Encode the communication Change to UTF-8
Don’t forget to select the check mark in the upper left corner. After selecting, the configuration just created will be bolded
You can see it on the right side of Pycharm File status in the remote folder
④ Set automatic synchronization
Menu bar>>> Tools>>> Deployment>> > Options, change from Never to Always or Show Save
so that the saved files will be automatically synchronized to the remote server.
⑤ If there is no automatic synchronization, right-click on the project file and find Deployment in the menu, you can also complete the upload or download
other problems
The configured ssh link can be used in multiple projects.
After the remote environment is configured, it can also be used in multiple projects.