LoginSignup
4
2

More than 5 years have passed since last update.

RaspberryPi3(STRETCH )にPython3.6を導入する

Last updated at Posted at 2018-05-23

Raspbian(STRETCH) にはPython2.7.13とPython3.5.3がデフォルトで入っているが、
機械学習などでPython3.6が要求された時のために、3.6をインストールをしておく。

準備

パッケージの更新とインストールしたpythonをビルドするためのツールをインストール

$ sudo apt-get update
$ sudo apt-get -y upgrade
$ sudo apt-get install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

インストール

Python3.6をダウンロードしてインストールする。
ソースコードをダウンロードする時は、公式サイトのPython3.6の最新版をにファイル名を置き換える。

$ wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
$ tar xf Python-3.6.5.tar.xz
$ cd Python-3.6.5
$ ./configure
$ make
$ sudo make altinstall

動作確認

ターミナルでpython3.6と入力しpythonの対話環境が起動したらインストール成功

$ python3.6
Python 3.6.5 (default, May 23 2018, 23:42:48)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

参考サイト

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2