How to update python from 3.5.2 to 3.5.3 on Linux

Thomas Nyberg tomuxiong at gmx.com
Wed May 3 10:50:34 EDT 2017


On 05/03/2017 10:34 AM, Daiyue Weng wrote:
> Hi, I am using Python 3.5.2 on Linux Mint (X64) at the moment, and
> wondering how to update it to 3.5.3. Are there some simple commands to do
> that?
> 
> cheers
> 
I wouldn't mess with the system python if I were you. That could clash
with Linux Mint's package management. Instead I would just install it in
my home directory as follows:

1. Create a folder like $HOME/src and download/extract the python 3.5.3
source to that directory.
2. Run (this may require installing your source repos first...see
below*) to install the necessary libraries to compile it:

	$ sudo apt-get update
	$ sudo apt-get build-dep python3.5

3. Go into $HOME/src/name_of_directory and run:

	$ ./configure --prefix=$HOME
	$ make && make install

4. After this you will be able to access this version of python as long
as you have your path setup right. I.e. if you open up an interpreter
and run:

	$ export PATH=$HOME/bin:$PATH

You can also add that to your $HOME/.bashrc file at the end so that it
happens automatically whenever you open a terminal.

After this is done you should have a fresh installation. At this point
you can install whatever and use python 3.5.3 without messing with your
system's python.

*Source repos. I'm having trouble finding a clear explanation adding
source repos on line (your google foo may be more advanced), but
basically you can go into your `/etc/apt/sources.list` file and replace
lines like (I use debian so it's a bit different) this:

	deb http://ftp.us.debian.org/debian/ jessie main non-free contrib

with slines like this:

	deb-src http://ftp.us.debian.org/debian/ jessie main non-free contrib

After you've done that you should run

	$ sudo apt-get update

CAUTION: If you haven't done this before, save yourself potential
problems by making a backup of the `/etc/apt/sources.list` file before
editing it...

Cheers,
Thomas



More information about the Python-list mailing list