1.安装软件管理工具
sudo apt-get install software-properties-common
2.添加软件源
sudo add-apt-repository ppa:jonathonf/python-3.6
3更新apt
sudo apt update
4.安装python3.6
sudo apt-get install python3.6
5.验证
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# python3.6
Python 3.6.8 (default, May 7 2019, 14:58:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
6.修改python3快捷方式
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# which python3
/usr/bin/python3
cd /usr/bin/
mv python3 python3.bk
ln -s python3.6 python3
7.验证快捷方式
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# python3
Python 3.6.8 (default, May 7 2019, 14:58:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
8.强制重装pip3 解决pip3报错(也可以使用)
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# pip3 install https://github.com/CrawlScript/WebCollector-Python/archive/master.zip
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip._internal'
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1733k 100 1733k 0 0 79621 0 0:00:22 0:00:22 --:--:-- 81820
root@iZ2vcf47jzvf8ea38o0y8lZ:/usr/bin# python3 get-pip.py --force-reinstall
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting pip
Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
|████████████████████████████████| 1.4MB 42.6MB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Successfully uninstalled pip-8.1.1
Successfully installed pip-19.2.3