簡體   English   中英

Google Colab中運行時突然無法更改Python版本

[英]Suddenly can't change Python version of runtime in Google Colab

我正在將 Google Colab 用於僅在 Python 2 中運行的項目(我正在復制舊作品)。 但是我想重置運行時,突然它不再連接(運行時不斷嘗試連接但斷開連接)。 這個錯誤會經常發生,我通常會做些什么來修復它是將運行時 Python 版本更改為 3,然后再改回 2。但是這次當我更改為 Python3 並訪問運行時設置選項以更改回 2時UI 上沒有選項可以更改回 Python 2 谷歌現在是否決定徹底擺脫 colabs 上的 Python2? 如果是這種情況,是否可以再次手動將其設置回 Python2? 先感謝您。

您可以使用此鏈接創建新的 Python 2.7 筆記本。

https://colab.research.google.com/notebook#create=true&language=python2

然后將舊代碼復制到其中,粘貼並運行。

另一種方法是下載您的 ipynb 文件,在文本編輯器中打開它,將運行時編輯為 python2。 然后上傳回來嘗試運行它。

The Python development team reported that Python 2 is no longer supported as of January 1, 2020. Colab has stopped updating Python 2 runtimes and will gradually no longer support Python 2 notebooks. 我們建議您將重要的筆記本遷移到 Python 3。

To change the notebook runtime from Python 2 to Python 3, select Runtime> Change Runtime Type and choose Python 3. It is no longer possible to change the runtime from Python 3 to Python 2. For information on how to migrate code from Python 2 to Python 3,參見 Python 2 至 Python 3 代碼可移植性。

colab 頁面解釋說

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM