2018年6月24日 星期日

樹莓派安裝 Python 編輯器 Thonny

今天在 Pi 3 上也安裝了 Thonny 編輯器, 安裝指令為 :

sudo apt-get install python3-thonny

參考 :

THONNY ON A RASPBERRY PI: USING THE NEW PYTHON IDE IN RASPBIAN
Installing Thonny on existing set up

安裝過程如下 :

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun May 13 15:05:30 2018 from 192.168.2.121
pi@raspberrypi:~ $ sudo apt-get install python3-thonny 
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  python-chardet-whl python-colorama-whl python-distlib-whl
  python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
  python-six-whl python-urllib3-whl python3-jedi python3-venv python3.4-venv
The following NEW packages will be installed:
  python-chardet-whl python-colorama-whl python-distlib-whl
  python-html5lib-whl python-pip-whl python-requests-whl python-setuptools-whl
  python-six-whl python-urllib3-whl python3-jedi python3-thonny python3-venv
  python3.4-venv
0 upgraded, 13 newly installed, 0 to remove and 214 not upgraded.
Need to get 2,859 kB of archives.
After this operation, 4,594 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-chardet-whl all 2.3.0-1 [170 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-colorama-whl all 0.3.2-1 [20.2 kB]
Get:3 http://archive.raspberrypi.org/debian/ jessie/main python3-jedi all 0.10.2 [127 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-distlib-whl all 0.1.9-1 [141 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-html5lib-whl all 0.999-3 [112 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-six-whl all 1.8.0-1 [14.8 kB]
Get:7 http://archive.raspberrypi.org/debian/ jessie/main python3-thonny all 2.1.10-1+rpi3~jessie [158 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-urllib3-whl all 1.9.1-3 [76.8 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-requests-whl all 2.4.3-6 [241 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-setuptools-whl all 5.5.1-1 [233 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pip-whl all 1.5.6-5 [126 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main python3.4-venv armhf 3.4.2-1 [1,438 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main python3-venv armhf 3.4.2-2 [1,100 B]
Fetched 2,859 kB in 13s (213 kB/s)
Selecting previously unselected package python-chardet-whl.
(Reading database ... 123711 files and directories currently installed.)
Preparing to unpack .../python-chardet-whl_2.3.0-1_all.deb ...
Unpacking python-chardet-whl (2.3.0-1) ...
Selecting previously unselected package python-colorama-whl.
Preparing to unpack .../python-colorama-whl_0.3.2-1_all.deb ...
Unpacking python-colorama-whl (0.3.2-1) ...
Selecting previously unselected package python-distlib-whl.
Preparing to unpack .../python-distlib-whl_0.1.9-1_all.deb ...
Unpacking python-distlib-whl (0.1.9-1) ...
Selecting previously unselected package python-html5lib-whl.
Preparing to unpack .../python-html5lib-whl_0.999-3_all.deb ...
Unpacking python-html5lib-whl (0.999-3) ...
Selecting previously unselected package python-six-whl.
Preparing to unpack .../python-six-whl_1.8.0-1_all.deb ...
Unpacking python-six-whl (1.8.0-1) ...
Selecting previously unselected package python-urllib3-whl.
Preparing to unpack .../python-urllib3-whl_1.9.1-3_all.deb ...
Unpacking python-urllib3-whl (1.9.1-3) ...
Selecting previously unselected package python-requests-whl.
Preparing to unpack .../python-requests-whl_2.4.3-6_all.deb ...
Unpacking python-requests-whl (2.4.3-6) ...
Selecting previously unselected package python-setuptools-whl.
Preparing to unpack .../python-setuptools-whl_5.5.1-1_all.deb ...
Unpacking python-setuptools-whl (5.5.1-1) ...
Selecting previously unselected package python-pip-whl.
Preparing to unpack .../python-pip-whl_1.5.6-5_all.deb ...
Unpacking python-pip-whl (1.5.6-5) ...
Selecting previously unselected package python3-jedi.
Preparing to unpack .../python3-jedi_0.10.2_all.deb ...
Unpacking python3-jedi (0.10.2) ...
Selecting previously unselected package python3.4-venv.
Preparing to unpack .../python3.4-venv_3.4.2-1_armhf.deb ...
Unpacking python3.4-venv (3.4.2-1) ...
Selecting previously unselected package python3-venv.
Preparing to unpack .../python3-venv_3.4.2-2_armhf.deb ...
Unpacking python3-venv (3.4.2-2) ...
Selecting previously unselected package python3-thonny.
Preparing to unpack .../python3-thonny_2.1.10-1+rpi3~jessie_all.deb ...
Unpacking python3-thonny (2.1.10-1+rpi3~jessie) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Setting up python-chardet-whl (2.3.0-1) ...
Setting up python-colorama-whl (0.3.2-1) ...
Setting up python-distlib-whl (0.1.9-1) ...
Setting up python-html5lib-whl (0.999-3) ...
Setting up python-six-whl (1.8.0-1) ...
Setting up python-urllib3-whl (1.9.1-3) ...
Setting up python-requests-whl (2.4.3-6) ...
Setting up python-setuptools-whl (5.5.1-1) ...
Setting up python-pip-whl (1.5.6-5) ...
Setting up python3-jedi (0.10.2) ...
2018-06-19 19:50:03 py2deb.hooks[30274] INFO Generated 56 Python bytecode files(s) for python3-jedi package.
Setting up python3.4-venv (3.4.2-1) ...
Setting up python3-venv (3.4.2-2) ...
Setting up python3-thonny (2.1.10-1+rpi3~jessie) ...

安裝完畢後在 Programming 工具集中就可找到 Thonny Python IDE 了, 操作方式與 Windows 上完全相同, 參考 :

好用的 Python 編輯器 Thonny







不過與 Windows 上不同的是, 安裝好後 Python 解譯器會先指向本機 Python 而非 Thonny 自帶的 BundledPython, 開啟 "Tools/Options" 確實是本機的 /usr/bin/Python3.4 :




因此開啟 "Tools/Manage Packages" 視窗時會出現一大堆已安裝套件列表 :




與 Windows 上一樣, 由於不是自帶的 Python, 無法在此 GUI 介面安裝/升級/刪除套件. 但可開啟 "Tools/Open system shell" 來進行操作, 例如升級 pip3 :

pi@raspberrypi:~ $ sudo -H pip3 install --upgrade pip
Downloading/unpacking pip from https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl#sha256=717cdffb2833be8409433a93746744b59505f42146e8d37de6c62b430e25d6d7
  Downloading pip-10.0.1-py2.py3-none-any.whl (1.3MB): 1.3MB downloaded
Installing collected packages: pip
  Found existing installation: pip 1.5.6
    Not uninstalling pip at /usr/lib/python3/dist-packages, owned by OS
Successfully installed pip
Cleaning up...
pi@raspberrypi:~ $ pip3 -V
pip 1.5.6 from /usr/lib/python3/dist-packages (python 3.4)

沒有留言 :