0

I would like to upgrade my python3 version from 3.2.3 to 3.3.x version. I am using Ubuntu 12.04

Referred this link. Is it the same procedure to upgrade the python version?

If so, then what must be run instead of sudo apt-get build-dep python3.4?

I have a doubt in the procedure because it is updating in same version line 3.4.x. Please refer and say so as to avoid further problems.

Edit 1: Also referred this link How do I install python 3.3 but did not help me.

anand mbs
  • 431
  • I tried it out but does not replace the default version – anand mbs Jun 07 '16 at 09:34
  • There are multiple answers there. Which ones did you try? – muru Jun 07 '16 at 09:35
  • All the answers are to install the python3.3 version in virtualenv and not in default location. Most of the answers are similar and tried the top 3. – anand mbs Jun 07 '16 at 09:38
  • What? The very first answer is to install python3.3 from the Deadsnakes PPA, which installs /usr/bin/python3.3, not in a virtualenv. Please read through. – muru Jun 07 '16 at 09:39
  • I did not raise the question without trying it @muru. It did not replace the default version – anand mbs Jun 07 '16 at 09:40
  • You want /usr/bin/python3 to be Python 3.3? Then just do sudo ln /usr/bin/python3.3 /usr/bin/python3 after using the deadsnakes PPA. – muru Jun 07 '16 at 09:41
  • does ln command not cause any problems? – anand mbs Jun 07 '16 at 09:47
  • You're try to make Python 3.3 the default. I'd be more worried about that than ln. – muru Jun 07 '16 at 09:48
  • does updating to 3.3 make any issues? – anand mbs Jun 07 '16 at 09:49
  • Who knows? Remember that all the Ubuntu packages that use Python 3 are tested with Python 3.2, not 3.3. There's no telling what might happen. That is why people suggest virtualenv - it's a bad idea to mess with /usr/bin/python and /usr/bin/python3. – muru Jun 07 '16 at 09:50
  • I am trying to make it due to the following question @muru question – anand mbs Jun 07 '16 at 09:50

1 Answers1

3

While relatively little in 12.04's core system relies on Python 3, I would always and in the strongest terms recommend that you leave the default Python environments to themselves.

That is to say:

  • Don't mess with the /usr/bin/python{,2,3} etc links.
  • Don't sudo {pip install,easy_install} anything into the system's site packages.

This is contrary to what you say you want to do but seriously, given you don't already know how to do this, you're a very long way away from knowing how to fix a broken system.

In your case, I'd recommend compiling your version of Python (in your home directory or even in /opt/) and then creating a virtualenv (venv) from that. Inside the virtualenv, python (and everything that uses it) will refer to the version of Python used during the creation of that environment.

cd project_directory
/path/to/python -m venv venv
. venv/bin/activate
pip install whatever
Oli
  • 293,335
  • So according to the answer and the comments, I avoid the updation of the python3 version. But what shall I do to install pip3? – anand mbs Jun 07 '16 at 10:27
  • You can run this script using the specific version of python to get pip for it, and then run this version and execute pip as a module, like /opt/python3/bin/python3.5 -m pip install emojitations. More info at pypa.io. – Stefano Palazzo Jun 07 '16 at 10:45
  • to avoid further problems, I am not going to update the python3 version and also going to skip installing pip3. No more options. – anand mbs Jun 07 '16 at 11:04