本文介绍了如何在Google计算引擎中使用PyCharm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个在Google云平台上运行的计算引擎实例.
I have a compute engine instance running on Google cloud platform.
我想将计算引擎的Python解释器用作Pycharm的远程解释器.这意味着我将在本地计算机上使用Pycharm并远程运行计算.
I would like to use the Python interpreter of the compute engine as a remote interpreter with Pycharm. This means that I would be using Pycharm on my local machine and running computations remotely.
关于如何实现这一目标的任何线索?
Any clue on how to achieve this?
推荐答案
以下要求,例如 James Hirschhorn 指出了PyCharm的专业版.
The following requires, as James Hirschhorn pointed out, the Professional verison of PyCharm.
- 将公共IP分配给GCP上的远程计算机.
- 运行
gcloudcompute config-ssh
将项目的VM自动添加到〜/.ssh/config
或手动将VM的公共IP添加到其中.如果跳过了步骤1,则每次重新启动远程VM时,都必须运行gcloudcompute config-ssh
,因为它始终会分配一个新的IP.〜/.ssh/config
填充了许多以下格式的条目:
- Assign a public IP to the remote machine on GCP.
- Run
gcloud compute config-ssh
to automatically add the VMs of your project to your~/.ssh/config
or manually add the public IP of your VM to it. If you skipped step 1. then you have to rungcloud compute config-ssh
every time you re-start the remote VM, because it always gets a new IP assigned. The~/.ssh/config
gets populated with many entries in the following format:
Host the-vm-host-name # use this in PyCharm's Host field
HostName 123.456.789.00 # the VM's IP address
Host
名称 python
.这篇关于如何在Google计算引擎中使用PyCharm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!