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
1 Answer
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.
-
3For many reasons, it is not a good idea to point
/usr/bin/python
topython3
. See for example stackoverflow.com/questions/43062608/…– BexCommented Aug 18, 2017 at 8: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.– hcheungCommented Aug 18, 2017 at 9: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.– MadMikeCommented Aug 18, 2017 at 11:25
make python3 as default
?