Transferred from: https://www.reddit.com/r/IPython/comments/3lf81w/using_python35_in_ubuntu_trusty/
Note:after installing python3.5 according to this scheme, many system programs can not be used. Because the System program uses 3.4, it can only restore the system Python version:
$ sudo rm/usr/bin/python3
$ sudo mv/usr/bin/python3-old/usr/bin/python3
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
$ sudo python get-pip.py
$ sudo pip3 install--upgrade Ipython[all]
$ sudo pip install--upgrade Ipython[all]
$ sudo rm-rf/usr/local/bin/ipython
$ sudo ln-s/usr/local/bin/ipython2/usr/local/bin/ipython
# Verify:
$ python--version
$ python3--version
$ python3.5--version
$ pip--version
$ PIP3--version
$ Ipython
$ ipython3
If you haven ' t already made the switch is installing from the source, and you want to install Python 3.5 system wide, you can use the following steps to upgrade to Python using the Fkrull/deadsnakes PPA.
Open a terminal window.
- Install Personal Package Archive:ppa:fkrull/deadsnakes
- sudo add-apt-repository ppa:fkrull/deadsnakes
- sudo apt-get update
- Install the following packages:
- sudo apt-get install python3.5
- sudo apt-get install Python3.5-dev
- sudo apt-get install Libncurses5-dev
- Change Python3 link to point to python3.5 instead of python3.4 (/usr/bin/)
- sudo mv/usr/bin/python3/usr/bin/python3-old
- sudo ln-s/usr/bin/python3.5/usr/bin/python3
- Install Pip from https://pip.pypa.io/en/stable/installing/
- wget https://bootstrap.pypa.io/get-pip.py
- sudo python3 get-pip.py
- Install the following with PIP3:
- sudo pip3 install setuptools--upgrade
- sudo pip3 install Ipython[all]
- Change the Python3 link back
- sudo rm/usr/bin/python3
- sudo mv/usr/bin/python3-old/usr/bin/python3
- Create python3.5 Kernel
- Cp-r ~/.ipython/kernels/python3 ~/.ipython/kernels/python3.5
- Sed-i--' s/3/3.5/g ' ~/.ipython/kernels/python3.5/kernel.json
After your do you can check by creating a Python 3.5 kernel Notebook and entering the following:
import syssys.version_info
You should get the following response.
sys.version_info(major=3, minor=5, micro=0, releaselevel=‘final‘, serial=0)
*edit:reverted the default Python3 to python3.4 and created a python3.5 kernel entry for the notebook. The reason for this was that changing the default Python3 to python3.5 broke the apt-get updating process.
Go Using Python3.5 in Ubuntu-trusty