teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

追記:実行例

2017/09/08 19:55

投稿

mt08
mt08

スコア1825

answer CHANGED
@@ -29,5 +29,78 @@
29
29
  ii libssl1.0.2:armhf 1.0.2l-2 armhf Secure Sockets Layer toolkit - shared libraries
30
30
  ii libssl1.1:armhf 1.1.0f-3 armhf Secure Sockets Layer toolkit - shared libraries
31
31
  pi@raspberrypi:~ $
32
+ ```
32
33
 
34
+
35
+ - `pyenv` の準備
36
+
33
- ```
37
+ ```
38
+ sudo apt update && sudo apt upgrade -y
39
+ sudo apt-get install -y build-essential libncursesw5-dev libgdbm-dev libc6-dev zlib1g-dev libsqlite3-dev tk-dev libssl-dev openssl libbz2-dev libreadline-dev
40
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
41
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
42
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
43
+ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
44
+ source ~/.bash_profile
45
+ #
46
+ # libssl1.0-devに差し替える
47
+ sudo apt install -y libssl1.0-dev libssl1.0.2
48
+ ```
49
+
50
+
51
+ - 実行例 : (2017-08-16-raspbian-stretch使用)
52
+ ```
53
+ pi@raspberrypi:~ $ cat /etc/issue
54
+ Raspbian GNU/Linux 9 \n \l
55
+ pi@raspberrypi:~ $ cat /etc/debian_version
56
+ 9.1
57
+ pi@raspberrypi:~ $ cat /etc/os-release
58
+ PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
59
+ NAME="Raspbian GNU/Linux"
60
+ VERSION_ID="9"
61
+ VERSION="9 (stretch)"
62
+ ID=raspbian
63
+ ID_LIKE=debian
64
+ HOME_URL="http://www.raspbian.org/"
65
+ SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
66
+ BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
67
+ pi@raspberrypi:~ $ uname -a
68
+ Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
69
+ pi@raspberrypi:~ $
70
+ pi@raspberrypi:~ $
71
+ pi@raspberrypi:~ $ time pyenv install 3.5.1
72
+ Downloading Python-3.5.1.tar.xz...
73
+ -> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
74
+ Installing Python-3.5.1...
75
+ Installed Python-3.5.1 to /home/pi/.pyenv/versions/3.5.1
76
+
77
+
78
+ real 15m17.827s
79
+ user 34m11.930s
80
+ sys 1m47.100s
81
+ pi@raspberrypi:~ $
82
+ pi@raspberrypi:~ $
83
+ pi@raspberrypi:~ $ python --version
84
+ Python 2.7.13
85
+ pi@raspberrypi:~ $ python3 --version
86
+ Python 3.5.3
87
+ pi@raspberrypi:~ $ pyenv local 3.5.1
88
+ pi@raspberrypi:~ $ pyenv versions
89
+ system
90
+ * 3.5.1 (set by /home/pi/.python-version)
91
+ pi@raspberrypi:~ $ python --version
92
+ Python 3.5.1
93
+ pi@raspberrypi:~ $ python3 --version
94
+ Python 3.5.1
95
+ pi@raspberrypi:~ $ pyenv which python
96
+ /home/pi/.pyenv/versions/3.5.1/bin/python
97
+ pi@raspberrypi:~ $ pyenv which python3
98
+ /home/pi/.pyenv/versions/3.5.1/bin/python3
99
+ pi@raspberrypi:~ $ pyenv local system
100
+ pi@raspberrypi:~ $ pyenv which python
101
+ /usr/bin/python
102
+ pi@raspberrypi:~ $ pyenv which python3
103
+ /usr/bin/python3
104
+ pi@raspberrypi:~ $
105
+ ```
106
+