安装 python 3.7 并设置为默认 python 版本
安装
更新
apt包列表,安装software-properties-common:1
2sudo apt update
sudo apt install software-properties-common添加
PPA1
2sudo add-apt-repository ppa:deadsnakes/ppa
提示输入 回车继续安装
python 3.61
sudo apt install python3.6
验证
1
python3.6 --version
配置为默认 Python 版本
更新
update-alternatives1
2sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2设置默认使用版本
1
2
3
4
5
6
7
8
9
10
11
12
13
14sudo update-alternatives --config python
此时将会出现下图
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.6 2 auto mode
1 /usr/bin/python2.7 1 manual mode
2 /usr/bin/python3.6 2 manual mode
Press <enter> to keep the current choice[*], or type selection number:
输入 2 即表示使用 python 3.7
或者也可以通过下面方式设置 python 3.7
sudo update-alternatives --set python /usr/bin/python3.6验证
1
2
3
4python --version
将显示:
Python 3.7.4
误删 python 3.6 至启动只有命令行
首先在命令行登录成功,然后在命令行连接上网络,这里显示连接 wifi 方法
1
2
3
4
5
6
7
8① 确定 wifi 接口名
nmcli d
② 确定 wifi 功能打开
nmcli r wifi on
③ 显示可以连接的 wifi
nmcli d wifi list
④ 使用密码连接
$ nmcli d wifi connect my_wifi password <password>确定网络连接成功后,安装 ubuntu-desktop
1
sudo apt-get install ubuntu-desktop
批量修改当前目录下的文件后缀名
1 | 将后缀名为 txt 文件全部改为 md |
动态查看 log
1 | tail -f test.log |
CentOS 7 服务器上运行 selenium
1 | 需要在相应位置添加 --headless --no-sandbox 两个参数 |
后台运行 nohup
1 | nohup bash test.sh >> ~/logs/test.log 2>&1 & |