2

I'm running Ubunutu 13.04. When using IPython, it points to a 3.3.1 copy of python that was installed in /usr/bin. I recently installed the most recent release of Python (3.3.2), which installed itself to /usr/local/bin. This means that typing 'python3' into the terminal, python3.3.2 comes up, but when I type 'ipython3', it uses 3.3.1.

I know this doesn't affect my programming (I'm not advanced of a user enough to make use of any of the differences between .1 and .2), but I'd still rather tidy my system up and use the most recent version. I tried using the fix given here, changing

#!/usr/bin/python3

to

#!/usr/local/bin/python3

But the following error is given:

Traceback (most recent call last): File "/usr/bin/ipython3", line 5, in from pkg_resources import load_entry_point ImportError: No module named 'pkg_resources'

So the questions are:

1) How can I make python3.3.2 install over 3.3.1 (ie not in /local/)? I have no need for 3.3.1 once 3.3.2 is going.

2) How can I change IPython to point to python in /local/?

3) Which one of these options is better?

Community
  • 1
  • 1
Mach
  • 73
  • 2
  • 3
  • 9
  • Did you try to install the `python-apt` package? It should make that error go away. – Bakuriu Jun 01 '13 at 06:31
  • I tried just then, and it said the most recent has already been installed. I'm not sure if the 3.3.2 detects it though. I just ran 'sudo apt-get install python-apt'. Is there a way to make sure the 3.3.2 in local reads it? – Mach Jun 01 '13 at 06:36
  • you should install the version for python3: `sudo apt-get install python3-apt`. – Bakuriu Jun 01 '13 at 06:38
  • Ah of course. However I tried that again, and it still said it is already the most recent version. – Mach Jun 01 '13 at 06:41
  • If you open python3.3.2 and try `import apt` the import succeeds? – Bakuriu Jun 01 '13 at 06:44
  • ImportError: No module named 'apt'. So the module doesn't seem to exist for the 3.3.2, doing it thought the terminal seems to only install it for the /usr/bin 3.3.1. I guess there must be some way to install packages for parallel versions of Python? Although this is getting messy, I think I'd prefer to install 3.3.2 over 3.3.1... – Mach Jun 01 '13 at 06:47
  • If you want to do that you must install python3.3.2 *without* using ubuntu's packaging system. Simply download the sources build and install it(specifying the correct prefix). However before doing this I'd try to uninstall `python3-apt` and reinstall it. – Bakuriu Jun 01 '13 at 06:50
  • I actually downloaded 3.3.2 and compiled it myself. I wasn't sure how to change the directory it installs to though. Do you know how to do this? Thanks for helping me through this, I really appreciate it. – Mach Jun 01 '13 at 06:56
  • 1
    Did you install ipython from source? I think ipython will use the same version of python that was used to build it. So `python3 pip install ipython`, or however you normally install. – cxrodgers Jun 01 '13 at 07:12
  • That appears to be working, thank you. Now it's time to find out how to get 3.3.2 on /usr/bin... – Mach Jun 01 '13 at 08:32

1 Answers1

0

While this is certainly not a very neat solution, if you are really desperate, you can backup /usr/bin/python3 and use ln -s to create a link from /usr/bin/python3 to /usr/local/bin/python3, as such:

mv /usr/bin/python3 /usr/bin/python3-backup
ln -s /usr/local/bin/python3 /usr/bin/python3

(you might need to use sudo)

Be warned that this might mess up automated uninstalls et cetera, so rather use this as a temporary fix

hlt
  • 6,219
  • 3
  • 23
  • 43