Ubuntu14.04自带的python3.4,如果想使用python3.5,需要自己下载:
下载Python3.5
添加 PPA:
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
安装 Python 3.5:
sudo apt-get install python3.5
sudo apt-get install python3.5-dev
sudo apt-get install libncurses5-dev
取消原本的 Python 3.4 ,并将 Python3 链接到最新的 3.5 上:
sudo mv /usr/bin/python3 /usr/bin/python3-old
sudo ln -s /usr/bin/python3.5 /usr/bin/python3
安装新版pip:
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
sudo pip3 install setuptools --upgrade
sudo pip3 install ipython[all]
切换回来链接文件:
sudo rm /usr/bin/python3
sudo mv /usr/bin/python3-old /usr/bin/python3
创建 Python 3.5 Kernel:
cp -R ~/.ipython/kernels/python3 ~/.ipython/kernels/python3.5
sed -i -- 's/3/3.5/g' ~/.ipython/kernels/python3.5/kernel.json
然后应该就可以了。
把 Python3 链接该回去但是使用 3.5 内核的原因是避免影响到 Ubuntu 的包管理更新。
然后更方便的使用python3.5
virtualenv -p /usr/bin/python3.5 yourenv
source yourenv/bin/activate
pip install package-name
pip下载慢或者失败怎么办?
Global settings:Add ~/.pip/pip.conf that includes:
[global]
timeout = 6000
index-url = https://pypi.doubanio.com/simple/
[install]
use-mirrors = true
mirrors = https://pypi.doubanio.com/simple/
trusted-host = pypi.doubanio.com
会出现2个警告:SNIMissingWarning, InsecurePlatformWarning