0x539
0x539

Reputation: 1496

Upgrade Python 3.2 to Python 3.4 on linux

I have Python 3.2 installed by default on my Raspbian Linux, but I want Python 3.4 (time.perf_counter, yield from, etc.). Installing Python 3.4 via apt-get is no problem, but when i type python3 in my shell I still get Python 3.2 (since /usr/bin/python3 still links to it). Should I change the Symlink, or is there a better was to do this?

Upvotes: 1

Views: 5943

Answers (2)

0x539
0x539

Reputation: 1496

I'm going to answer my own question, since I have found a solution to my problem. I had previously run apt-get upgrade on my system after setting my debian release to jessie. This did not replace python 3.2 though. What did replace it was running apt-get dist-upgrade; after that apt-get autoremove removed python 3.2. I doubt that this could be a problem, since I hadn't installed any external libraries.

Upvotes: 2

You must not change the symlink as there might be Debian utility scripts that depend on the python3 being Python 3.2 or having a particular library installed. There are a multitude of command line utilities that depend on particular version on Debian and derived versions; for example on my Ubuntu, there are scripts in /usr/bin with python3 on shebang; there the python3 means that Python 3 that the operating system keeps the current. If you install Python 3 by hand, it is not the one that operating system thinks is useable as python3 for all scripts. An example from my Ubuntu 14.10 system:

[/usr/bin]% python3 bluez-list-devices  
[/usr/bin]% python3.4 bluez-list-devices  
[/usr/bin]% python3.3 bluez-list-devices
Traceback (most recent call last):
  File "bluez-list-devices", line 3, in <module>
    import dbus
  File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 82, in <module>
    import dbus.types as types
  File "/usr/lib/python3/dist-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ImportError: No module named '_dbus_bindings'
[/usr/bin]% head -n 1 bluez-list-devices
#!/usr/bin/python3

If you change the symlink at your own decision, at worst you can make the system unbootable.

Just use python3.4 as the command, or use a virtual environment.

Upvotes: 3

Related Questions