
🌐 이 글의 한국어 원문이 있습니다.한국어 원문 보기 →
Using PyCharm Remotely
Sometimes it's simply hard to set up a development environment on your 'desktop.' This happens when your desktop runs 'Windows' but the development environment only works on 'Linux' or 'Unix.' In that case, development becomes a tedious cycle of uploading your code and then running it on the server. With 'PyCharm,' however, there's no need to run things separately on the server — you can run them on the server directly from 'PyCharm.' This is the feature called 'SSH Interpreter.'
*Python remote (SSH Interpreter) is only supported in 'PyCharm Professional'; it is not supported in the 'PyCharm Community' edition. Students can use PyCharm Professional for free by verifying a school email address, so don't hesitate — sign up and try the Pro version.
To explain the basic concept of the feature: the files you work on at your desktop are uploaded to the server, and that Python file is then executed on the server over the SSH protocol. Because execution happens in the server's Python interpreter, you naturally use the 'libraries' available to the 'server's' interpreter. Folders are also accessed relative to the 'server.'
Setup
In Settings → Python Interpreter, click the 'gear' icon in the upper right and click Add...

From the list, choose SSH Interpreter.
Then enter the 'host' address (IP) and your username.

Enter your password. If you use a key for authentication, specify the path to the key file.

If the 'connection' was made successfully, the 'interpreter' path and the 'sync folders' should appear as shown below. Specify the Python interpreter file you want to run on the server, and specify which path on the server your computer's working folder should map to. If you don't specify one, PyCharm creates an arbitrary folder under /tmp and uses it. Keep in mind that if you don't specify one, that temporarily created folder becomes the 'working directory' when your Python files run.

Clicking the sync folders box brings up a popup like the one below. There you can specify your local folder and the remote folder you want to sync it with.
On Linux, you can change the path later. On Windows, however, editing the path occasionally doesn't work. If that happens, you need to delete the interpreter you created and register it again.

If there's more than one local folder you want to 'sync,' you can add more. The one thing you must remember here is that 'where the files run' is the 'server.' They are never executed on your own 'computer.'
(Some blogs claim that 'PyCharm' doesn't offer 'true remote' support and that only VS Code supports remote development 'completely.' That's a hard claim to accept. Both PyCharm and VS Code execute on the server over SSH. For both, the place where code runs is the same: the 'server.' If the way code is executed is the same, there's no reason for there to be any 'difference' in remote support.)
Once setup is complete, it shows the list of libraries on the 'remote (server).' You can manage the libraries you need right from PyCharm.

From then on, when you edit code in PyCharm and hit 'RUN,' the code runs on the server.
If you want to 'sync' folders between your desktop and the server, right-click the 'project' folder in the left-hand tab and click 'Deployment' — you'll see 'Sync with Deployed to' followed by your 'server address.' Clicking it brings up a sync screen like the one below.

