1.下载python3.9
sudo apt-get install python3.9
2.切换
sudo su
输入下面指令
update-alternatives --list python
update-alternatives: error: no alternatives for python
出现以上所示的错误信息,则表示 Python 的替代版本尚未被update-alternatives 命令识别。想解决这个问题,我们需要更新一下替代列表,将python3.8 和 python3.9 放入其中。
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python (python) in auto mode
update-alternatives: using /usr/bin/python3.9 to provide /usr/bin/python (python) in auto mode
```python
update-alternatives: using /usr/bin/python3.8 to provide /usr/bin/python3 (python3) in auto mode
update-alternatives: using /usr/bin/python3.9 to provide /usr/bin/python3 (python3) in auto mode
再输入
python -v
python3 -V
到这里python切换完成
3.安装虚拟环境 1
sudo apt-get install python3.9-venv
python3 -m venv ~/bfvenv
cd ~/bfvenv
source ~/bfvenv/bin/activate
出现以及即代表完成
|