I have a Raspberry pi 3 Model B and I want to install Python 3.6 on it.
A bit of context:
I acquired this Raspberry pi over 2 years ago and it came with Python 2.7 and 3.4 installed by default in /usr/bin/.
To install Python 3.6, I used the following instructions:
https://installvirtual.com/install-python-3-on-raspberry-pi-raspbian/
Briefly, the commands in that link are:
$ sudo apt-get install -y 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 libffi-dev
$ wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
$ sudo tar zxf Python-3.6.8.tgz
$ cd Python-3.6.8
$ ./configure
$ make -j 4
$ make altinstall
I tried following theses instructions but:
1) I made a directory in my home into which I downloaded the .tgz file. In other words, before the wget command, I did:
$ cd
$ mkdir my-packages/my-python3.6 && cd /my-packages/my-python3.6
I don't think this changes anything but in any case, I thought I should say it.
2) All was well but when doing the ./configure command and the following 2, I was shown a permission denied. Unfortunately I don't have the exact error messages for all 3 commands (the output was so big I can't go back) but I do have it for the "make -j 4" command:
Assembler messages:
Fatal error: can't create Parser/grammar1.o: Permission denied
Makefile:1589: recipe for target 'Parser/grammar1.o' failed
make: *** [Parser/grammar1.o] Error 1
make: *** Waiting for unfinished jobs....
Assembler messages:
Fatal error: can't create Programs/python.o: Permission denied
Makefile:766: recipe for target 'Programs/python.o' failed
make: *** [Programs/python.o] Error 1
Assembler messages:
Fatal error: can't create Parser/acceler.o: Permission denied
Makefile:1589: recipe for target 'Parser/acceler.o' failed
make: *** [Parser/acceler.o] Error 1
Assembler messages:
Fatal error: can't create Parser/listnode.o: Permission denied
Makefile:1589: recipe for target 'Parser/listnode.o' failed
make: *** [Parser/listnode.o] Error 1
When I used "sudo" in front of all 3 commands, it seems to work.
So my question is: Why did I need to use sudo for all 3 commands? I have not found any tutorial saying this. Maybe I'm overthinking this but I find it weird to have needed sudo when no else seemed to. Could I have done something wrong?
Also, is it common for a Python installed from source to go to /usr/local/bin?
My sudo rights are:
$ sudo -l
# Output:
Matching Defaults entries for pi on raspberrypi:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User pi may run the following commands on raspberrypi:
(ALL : ALL) ALL
(ALL) NOPASSWD: ALL
Thanks.