I want to make python 3 as default in raspberry pi 3b and install scikit-learn and scikit-plot for the python 3 version. What are exact steps to be followed. Appreciate your input. Thank you
Asked
Active
Viewed 2.0k times
4
1 Answers
3
If you run linux command ls -l python*
within the directory, you will see that python
is just a symlink to python2.7, if you know linux commands well enough, you can easily make a change to link python -> python3
.
One more thing you need to aware is that in order to install packages for python3, you need to run pip3
. This is probably the reason that you run into the case where "No module name 'script'" error. Again, run ls -l pip*
to find out more.
You can also run pip3 list
to check what packages are installed for python3.

hcheung
- 845
- 7
- 14
-
3For many reasons, it is not a good idea to point
/usr/bin/python
topython3
. See for example https://stackoverflow.com/questions/43062608/how-to-update-alternatives-to-python-3-without-breaking-apt – Bex Aug 18 '17 at 08:52 -
@Bex, I won't recommend messing with the default installation either (which is the link that you referred to is doing). However, to put a symbolic link so that typing
python
to launchpython3
instead of the defaultpython2
is a different story, and do no harm for the fundamental system installation. – hcheung Aug 18 '17 at 09:35 -
2Instead of changing the default system-wide you could change it just for your pi-user. Do this:
sudo apt install python3; mkdir ~/bin; ln -s /usr/bin/python3 ~/bin/python
. Log your user out and log back in. Do this:which python
, This should return/home/pi/bin/python
. Now everthing under this user will use the symlink which points to python3. Delete~/bin/python
, log out and back in to revert this change. – MadMike Aug 18 '17 at 11:25
make python3 as default
? – Jul 10 '17 at 05:16