回答編集履歴

1

追記:実行例

2017/09/08 19:55

投稿

mt08
mt08

スコア1825

test CHANGED
@@ -60,6 +60,154 @@
60
60
 
61
61
  pi@raspberrypi:~ $
62
62
 
63
-
64
-
65
- ```
63
+ ```
64
+
65
+
66
+
67
+
68
+
69
+ - `pyenv` の準備
70
+
71
+
72
+
73
+ ```
74
+
75
+ sudo apt update && sudo apt upgrade -y
76
+
77
+ 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
78
+
79
+ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
80
+
81
+ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
82
+
83
+ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
84
+
85
+ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
86
+
87
+ source ~/.bash_profile
88
+
89
+ #
90
+
91
+ # libssl1.0-devに差し替える
92
+
93
+ sudo apt install -y libssl1.0-dev libssl1.0.2
94
+
95
+ ```
96
+
97
+
98
+
99
+
100
+
101
+ - 実行例 : (2017-08-16-raspbian-stretch使用)
102
+
103
+ ```
104
+
105
+ pi@raspberrypi:~ $ cat /etc/issue
106
+
107
+ Raspbian GNU/Linux 9 \n \l
108
+
109
+ pi@raspberrypi:~ $ cat /etc/debian_version
110
+
111
+ 9.1
112
+
113
+ pi@raspberrypi:~ $ cat /etc/os-release
114
+
115
+ PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
116
+
117
+ NAME="Raspbian GNU/Linux"
118
+
119
+ VERSION_ID="9"
120
+
121
+ VERSION="9 (stretch)"
122
+
123
+ ID=raspbian
124
+
125
+ ID_LIKE=debian
126
+
127
+ HOME_URL="http://www.raspbian.org/"
128
+
129
+ SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
130
+
131
+ BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
132
+
133
+ pi@raspberrypi:~ $ uname -a
134
+
135
+ Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
136
+
137
+ pi@raspberrypi:~ $
138
+
139
+ pi@raspberrypi:~ $
140
+
141
+ pi@raspberrypi:~ $ time pyenv install 3.5.1
142
+
143
+ Downloading Python-3.5.1.tar.xz...
144
+
145
+ -> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
146
+
147
+ Installing Python-3.5.1...
148
+
149
+ Installed Python-3.5.1 to /home/pi/.pyenv/versions/3.5.1
150
+
151
+
152
+
153
+
154
+
155
+ real 15m17.827s
156
+
157
+ user 34m11.930s
158
+
159
+ sys 1m47.100s
160
+
161
+ pi@raspberrypi:~ $
162
+
163
+ pi@raspberrypi:~ $
164
+
165
+ pi@raspberrypi:~ $ python --version
166
+
167
+ Python 2.7.13
168
+
169
+ pi@raspberrypi:~ $ python3 --version
170
+
171
+ Python 3.5.3
172
+
173
+ pi@raspberrypi:~ $ pyenv local 3.5.1
174
+
175
+ pi@raspberrypi:~ $ pyenv versions
176
+
177
+ system
178
+
179
+ * 3.5.1 (set by /home/pi/.python-version)
180
+
181
+ pi@raspberrypi:~ $ python --version
182
+
183
+ Python 3.5.1
184
+
185
+ pi@raspberrypi:~ $ python3 --version
186
+
187
+ Python 3.5.1
188
+
189
+ pi@raspberrypi:~ $ pyenv which python
190
+
191
+ /home/pi/.pyenv/versions/3.5.1/bin/python
192
+
193
+ pi@raspberrypi:~ $ pyenv which python3
194
+
195
+ /home/pi/.pyenv/versions/3.5.1/bin/python3
196
+
197
+ pi@raspberrypi:~ $ pyenv local system
198
+
199
+ pi@raspberrypi:~ $ pyenv which python
200
+
201
+ /usr/bin/python
202
+
203
+ pi@raspberrypi:~ $ pyenv which python3
204
+
205
+ /usr/bin/python3
206
+
207
+ pi@raspberrypi:~ $
208
+
209
+ ```
210
+
211
+
212
+
213
+