iT邦幫忙

0

關於macOS下Python版本的問題

  • 分享至 

  • xImage

如題,因為要使用GCP的SDK,谷歌官方文件說需要Python 3 ,我之前已經有載好Python 3了,但是在terminal輸入 python -v 出現的是

This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.

我知道macOS本身就有自帶的Python 2 但照上面的意思,是不是需要修改環境變數呢?
還是說我電腦裡有Python 3下載的Google Cloud SDK 他有辦法自己抓到Python 3呢?
(OS版本是Big Sur 本身沒有在開發Python, 純粹都是第三方軟體需要)
還請前輩們幫忙指點一下,感恩了!

https://pythonguidecn.readthedocs.io/zh/latest/starting/install3/osx.html
python3 -v
which python3
試試看
samuraigo iT邦新手 4 級 ‧ 2021-07-25 02:53:27 檢舉
好的! 感謝兩位大大,終於有搞懂他的機制了><
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
VP
iT邦新手 1 級 ‧ 2021-07-24 01:07:20

不少Unix-like的作業系統會內建py2
所以如果直接打"python"的話有不小的機率你會發現你在用的是py2
當裝了py3後通常是打"python3"以和py2作區別
而如果你想要讓系統打python使用的是py3而非py2的話
可以去替代檔案或是使用alias

samuraigo iT邦新手 4 級 ‧ 2021-07-25 02:54:57 檢舉

感謝大大解惑,有明白他的判定了!

我要發表回答

立即登入回答