查看 python3版本
python3
-
-
version
安装python3.7
sudo
apt-get
install
python3.7
报错如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3.7
E: Couldn't find any package by glob 'python3.7'
E: Couldn't find any package by regex 'python3.7'
使用的ppa是旧版本:
sudo add-apt-repository ppa:jonathonf/python-3.7
提示:
sudo: add-apt-repository: command not found
执行:
sudo apt-get install software-properties-common
需要将ppa更新:
sudo add-apt-repository ppa:deadsnakes/ppa
然后 系统更新:
sudo apt-get update
最后,安装python3.7
sudo apt-get install python3.7
为了方便使用,建议创建软连接
首先把之前的软连接删除:
sudo
rm
-rf
/usr/bin/python3
sudo
rm
-rf
/usr/bin/pip3
查看Python3.7安装路径:
which python3.
7
然后创建新的软连接:
sudo ln -s /usr/bin/python3.7 /usr/bin/python3
sudo ln -s /usr/bin/pip3 /usr/bin/pip3
sudo apt-get install python3.7-dev
查看python3版本
python3 --version
更新完后
后面用python3 -m pip install xxxx,报错如下:
/usr/bin/python3: No module named pip
需要运行apt-get install python3-pip