Local pycharm connects to remote server (take AutoDL as an example)

Prepare

  1. Professional version of PyCharm (community version does not support remote development function)
  2. Remote server (here using AutoDL)

If necessary, you can register for AutoDL

registration link

Boot instance

Copy your own instance SSH command

If it is blank in the picture, it is because you have not turned on the computer, you can copy it when you turn it on
insert image description here
insert image description here

In ssh -p 43677 [email protected]the command, the meaning of each parameter is:

User name: root
HOST: region-41.seetacloud.com
Port number: 43677

Configure PyCharm

  1. Configure the Python interpreter

File -> Settings -> Python interpreter
insert image description here
insert image description here

Click the small gear on the right and click Add

insert image description here

  1. Enter account password

Match and fill in the Host, Port and Username in the SSH command of the instance (the Username is root, and the Host and Port view the SSH command of your own instance)

用户名:root
HOST: region-41.seetacloud.com
端口号:43677

Enter password: This password is also copied under the SSH login in the AutoDL instance.
insert image description here

Continue to the next step until you see the popup below. Select System Interpreter, and configure the address of the remote Python interpreter as /root/miniconda3/bin/python(if you have installed other Python or virtual environment, fill in according to the actual situation)

Configure the synchronization directory, which means that the local project is associated with the directory in the remote instance, here it is set as the data disk subdirectory of the instance: (It is not /root/autodl-tmp/project/ recommended to use the default /tmp directory)Note that the location here is where your future code exists
insert image description here

Click Create, if the configuration is correct, PyCharm will have a small meeting configuration process, and you can develop remotely after completion.

  1. synchronous operation

If you can't find the Python file at runtime, it may be that there is no automatic synchronization code, then you can choose manual synchronization:
insert image description here
if you just want to upload a certain file, you can directly right click on the uploaded file, and there is also a Deployment option

Guess you like

Origin blog.csdn.net/qq_43585922/article/details/129395867