在Ubuntu 16.04 安装python3.6 环境并设置为默认
1.添加python3.6安装包,并且安装
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt-get update
sudo apt-get install python3.6
2.修改系统默认python版本为3.6
1 2 3 |
|
3.升级pip版本
python pip install --upgrade pip
如果出现 ModuleNotFoundError: No module named 'apt_pkg'
-
$ sudo apt-get remove --purge python-apt
-
$ sudo apt-get install python-apt -f
-
$ sudo find / -name "apt_pkg.cpython-35m-x86_64-linux-gnu.so"
-
$ cd /usr/lib/python3/dist-packages/
-
$ sudo cp apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.cpython-36m-x86_64-linux-gnu.so