Aug-11-2019, 08:24 AM
I have a video on how to install Python on YouTube[1]. I also have a blog post[2] on my website. The basic steps are
sudo apt-get update
Now that the package lists have been updated we can upgrade to the latest versions with the apt-get upgrade command:
sudo apt-get -y upgrade
Once the packages have been upgraded, we can install Python 3.7. This is done with the apt-get install command:
sudo apt-get install -y python3.7
Once the installation is complete, we confirm that it was successful by calling Python 3.7 and printing out the version number:
python3.7 -V
# expected output
Python 3.7.3
Now we have successfully completed the installation of Python. Since we want to work with other Python packages in the future, we can now install the package management program PIP. For this we execute the following command:
sudo apt-get install -y python3-pip
In the following, we make sure that Python 3.7 is the latest python3 version. To achieve that we set a symbolic link to python3.
sudo ln -sf /usr/bin/python3.7 /usr/bin/python3
Once PIP has been installed we have to update PIP. Unfortunately we have to do this manually although we have just installed PIP, cause the installed version is pretty old, so yes, this step is necessary:
python3 -m pip install --upgrade pip
Once the installation is complete we also confirm this by calling the version number of PIP:
python3 -m pip -V
# expected output
pip 19.2.1 from /home/vagrant/.local/lib/python3.7/site-packages/pip (python 3.7)
Now we are still testing if we can actually install libraries with PIP. For this we use a very popular Python math library named numpy
python3 -m pip install numpy
[1]: https://youtu.be/PKUrhVqEpxE
[2]: https://techdiffuse.com/en/2019/08/06/py...o-install/
sudo apt-get update
Now that the package lists have been updated we can upgrade to the latest versions with the apt-get upgrade command:
sudo apt-get -y upgrade
Once the packages have been upgraded, we can install Python 3.7. This is done with the apt-get install command:
sudo apt-get install -y python3.7
Once the installation is complete, we confirm that it was successful by calling Python 3.7 and printing out the version number:
python3.7 -V
# expected output
Python 3.7.3
Now we have successfully completed the installation of Python. Since we want to work with other Python packages in the future, we can now install the package management program PIP. For this we execute the following command:
sudo apt-get install -y python3-pip
In the following, we make sure that Python 3.7 is the latest python3 version. To achieve that we set a symbolic link to python3.
sudo ln -sf /usr/bin/python3.7 /usr/bin/python3
Once PIP has been installed we have to update PIP. Unfortunately we have to do this manually although we have just installed PIP, cause the installed version is pretty old, so yes, this step is necessary:
python3 -m pip install --upgrade pip
Once the installation is complete we also confirm this by calling the version number of PIP:
python3 -m pip -V
# expected output
pip 19.2.1 from /home/vagrant/.local/lib/python3.7/site-packages/pip (python 3.7)
Now we are still testing if we can actually install libraries with PIP. For this we use a very popular Python math library named numpy
python3 -m pip install numpy
[1]: https://youtu.be/PKUrhVqEpxE
[2]: https://techdiffuse.com/en/2019/08/06/py...o-install/