I need python newest version in raspberry pi.
I tried apt install python3 3.8
apt install python3
but this didnot work.
And I also needed to update my raspberry pi python IDLE
All you have to do is visit the Python downloads page and download the latest version. Clicking on the button will replace the existing version of Python with the new version. The older version will be removed from your computer. After you restart the computer, the new patch will be installed on your machine.
If you're using a Linux-based OS, this includes Raspberry Pi users, you can use the Terminal application to check your Python version. To open Terminal, press Ctrl + Alt + T. Type this command into the Terminal window and press Enter. This will return info containing your current Python version.
If you are using the desktop versions of Raspberry Pi OS, Python will come pre-installed on your system, so skip to the next section. If you use your Raspberry Pi as a headless device, you can complete the following steps over SSH. You do not need physical access to your device to be able to use Python.
First update the Raspbian.
sudo apt-get update
Then install the prerequisites that will make any further installation of Python and/or packages much smoother.
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
And then install Python, maybe by downloading a compressed file?
example 1 :
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
Extract the folder :
sudo tar zxf Python-3.8.0.tgz
Move into the folder :
cd Python-3.8.0
Initial configuration :
sudo ./configure --enable-optimizations
Run the makefile inside the folder with the mentioned parameters :
sudo make -j 4
Run again the makefile this time installing directly the package :
sudo make altinstall
Maybe You already did it but You don't know how to setup the new version as a default version of the system?
Check first that it has been installed :
python3.8 -V
Send a strong command to .bashrc telling him who (which version) is in charge of Python
echo "alias python=/usr/local/bin/python3.8" >> ~/.bashrc
Again! Tell him because .bashrc has to understand! I am joking - You have to source the file so the changes can be applied immediately :
source ~/.bashrc
And then check that Your system changed the default version of Python to Python 3.8
python -V
The failure depends on many factors : what dependencies are installed, what are the packages added to the source_list.d, some inconvenient coming up during the installation. All may give you more information than you think, just read carefully. Hope it helped.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With