2017-06-06 107 views
1

我剛剛開始使用Google雲端控制檯。我創建了一個VM(紅帽企業Linux 7)。預裝Python 2.7。我如何更新到Python 3?另外'點子安裝'不起作用;我假設,一旦我得到更新,將與Python 3一起。如何在Google雲端控制檯上安裝python 3?

+0

您可以通過設置這個指令後 HTTPS點子自己.org /安裝/#install-pip-setuptools-and-wheel 或者一個簡單的谷歌搜索在RHEL7上安裝python3。 – Guagua

+0

謝謝......似乎我需要成爲root來安裝python3。有關如何在Google VM上獲得root權限的任何建議? – trdr

+0

sudo -u root -i或者只安裝sudo yum。這不是谷歌的具體,只是通用的Linux。 – Guagua

回答

0

在GCE VM上運行的RHEL 7與在自己的物理服務器上運行的RHEL 7基本相同。

有一點需要注意的是,默認情況下,在GCE Vms中,使用ssh默認帳戶啓用無密碼sudo。

一旦你ssh到虛擬機(無論是從瀏覽器或使用gcloud compute ssh),可以按照下列步驟操作://packaging.python:

# Install Python 3.4 
sudo yum -y install python34 

# Install python-setuptools which will bring in easy_install 
sudo yum -y install python34-setuptools 

# Install pip using easy_install 
sudo easy_install-3.4 pip 
+0

謝謝!接下來我無法弄清楚的是如何在Mac上安裝'gcloud'命令。有什麼建議麼? – trdr

+0

我想你應該問一個單獨的問題。完成後,您可以將鏈接發佈爲評論。 – Tuxdude

+0

@trdr https://cloud.google.com/sdk/docs/quickstart-mac-os-x – Guagua