本系列測試文章參考索引 :
# Nvidia Jetson Nano 測試筆記索引
Jetson Nano 的 Ubuntu 18.04 只預載了 Python 2.7.15, 沒有 Python 3, 用 python -V 或 python --version 指令可查詢 Python 2 的版本 :
tony1966@jetson-nano-tony1966:~$ python -V
Python 2.7.15+
tony1966@jetson-nano-tony1966:~$ python --version
Python 2.7.15+
因為機器學習套件要用到 Python 3, 必須自行安裝, 作法參考下列文章 :
# 在Linux上安装Python 3
# How To Install Python 3.7 On Ubuntu 18.04
# How to Install Python 3.8 on Ubuntu 18.04
# Ubuntu 安裝 Python 3 (IDLE)
# 如何在Ubuntu 18.04上安装Python 3并建立本地编程环境
# 如何在Ubuntu 16.10上為Python 3.6安裝pip?
# Ubuntu 環境下安裝 pip & python3
1. 更新套件清單 :
tony1966@jetson-nano-tony1966:~$ sudo apt update
2. 安裝支援軟體 software-properties-common 套件 :
此套件會可讓我們添加個人套件庫 (PPA, Personal Package Archive), 可增進我們對套件管理員的控制 :
tony1966@jetson-nano-tony1966:~$ sudo apt install software-properties-common
[sudo] password for tony1966: (輸入登入密碼後按 Enter, 密碼不會顯示)
此指令需按 Y 才會繼續安裝 :
是否繼續進行 [Y/n]? [Y/n] Y
3. 新增名為 deadsnakes 的 PPA :
tony1966@jetson-nano-tony1966:~$ sudo add-apt-repository ppa:deadsnakes/ppa
此指令需按 Enter 才會繼續安裝 :
Press [ENTER] to continue or Ctrl-c to cancel adding it. (按 Enter 鍵)
4. 再更新套件清單 :
tony1966@jetson-nano-tony1966:~$ sudo apt update
接下來就可以安裝 Python 3 了, 目前最新版本是 Python 3.8 :
5. 安裝 Python 3.8 :
tony1966@jetson-nano-tony1966:~$ sudo apt install python3.8
此指令需按 Y 才會繼續安裝 :
是否繼續進行 [Y/n]? [Y/n] Y
安裝完成後必須用 python3.8 指令檢查版本 :
tony1966@jetson-nano-tony1966:~$ python3.8 --version
Python 3.8.3
tony1966@jetson-nano-tony1966:~$ python3.8 -V
Python 3.8.3
如果用 python 或 python3 會出現錯誤 :
tony1966@jetson-nano-tony1966:~$ python ––version
python: can't open file '––version': [Errno 2] No such file or directory
tony1966@jetson-nano-tony1966:~$ python3 ––version
python3: can't open file '––version': [Errno 2] No such file or directory
tony1966@jetson-nano-tony1966:~$ python –V
python: can't open file '–V': [Errno 2] No such file or directory
輸入 python3.8 進入 Python Shell 介面 :
tony1966@jetson-nano-tony1966:~$ python3.8
Python 3.8.3 (default, May 14 2020, 20:11:43)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello World!')
Hello World!
這樣就安裝好 Python 3 了, 接下來要即可安裝 Python 機器學習套件.
參考 :
# Change the Python3 default version in Ubuntu
# How to make 'python' program command execute Python 3?
# Configure Python 3 as default on Ubuntu
是否繼續進行 [Y/n]? [Y/n] Y
安裝完成後必須用 python3.8 指令檢查版本 :
tony1966@jetson-nano-tony1966:~$ python3.8 --version
Python 3.8.3
tony1966@jetson-nano-tony1966:~$ python3.8 -V
Python 3.8.3
tony1966@jetson-nano-tony1966:~$ python ––version
python: can't open file '––version': [Errno 2] No such file or directory
tony1966@jetson-nano-tony1966:~$ python3 ––version
python3: can't open file '––version': [Errno 2] No such file or directory
tony1966@jetson-nano-tony1966:~$ python –V
python: can't open file '–V': [Errno 2] No such file or directory
tony1966@jetson-nano-tony1966:~$ python3.8
Python 3.8.3 (default, May 14 2020, 20:11:43)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('Hello World!')
Hello World!
這樣就安裝好 Python 3 了, 接下來要即可安裝 Python 機器學習套件.
參考 :
# Change the Python3 default version in Ubuntu
# How to make 'python' program command execute Python 3?
# Configure Python 3 as default on Ubuntu
沒有留言 :
張貼留言