ARST打卡第97周[97/521]

Algorithm

简单实现hashtable

Review

如何让你的智力提高10倍?

每年读十本难读的书,锻炼自己的思维

Tips

You have new mail in /var/spool/mail/root提示,查看,关闭邮件

Share

Centos7安装python3以及后续兼容yum

1
2
3
4
5
6
## 下载epel:
sudo yum install epel-release
## 安装python3:(python36是python3加一些pip等组件),可以去掉 -y 查看
sudo yum install -y python36
[root@lm graduate_work]# python3 --version
Python 3.6.8

修改默认的python和pip版本,并更改yum的python版本为python2.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
[root@lm build]# whereis python
python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python3.6 /usr/bin/python3.6m /usr/lib/python2.7 /usr/lib/python3.6 /usr/lib64/python2.7 /usr/lib64/python3.6 /etc/python /usr/include/python2.7 /usr/include/python3.6m /usr/share/man/man1/python.1.gz
[root@lm build]# ll /usr/bin/python
lrwxrwxrwx. 1 root root 7 2月 17 01:36 /usr/bin/python -> python2
[root@lm build]# ln -s /usr/bin/python3.6 /usr/bin/python
ln: 无法创建符号链接"/usr/bin/python": 文件已存在
[root@lm build]# rm /usr/bin/python
rm:是否删除符号链接 "/usr/bin/python"?y
[root@lm build]# ln -s /usr/bin/python3.6 /usr/bin/python
[root@lm build]# python --version
Python 3.6.8
[root@lm build]# pip --version
bash: pip: 未找到命令
[root@lm build]# whereis pip
pip: /usr/bin/pip3.6
[root@lm build]# ln -s /usr/bin/pip3.6 /usr/bin/pip
[root@lm build]# pip --version
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

[root@lm build]# yum
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax
[root@lm build]# vim /usr/bin/yum
[root@lm build]# cat /usr/bin/yum | head -1
#!/usr/bin/python2.7
Downloading packages:
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax
File "/usr/libexec/urlgrabber-ext-down", line 28
except OSError, e:
^
SyntaxError: invalid syntax


由于用户取消而退出
[root@lm build]# vim /usr/libexec/urlgrabber-ext-down
[root@lm build]# cat /usr/libexec/urlgrabber-ext-down | head -1
#! /usr/bin/python2.7


您在 /var/spool/mail/root 中有邮件
[root@lm download]# cat /var/spool/mail/root
From root@lm.localdomain Fri Mar 12 14:01:01 2021
Return-Path: <root@lm.localdomain>
X-Original-To: root
Delivered-To: root@lm.localdomain
Received: by lm.localdomain (Postfix, from userid 0)
id 488F220BCEB8; Fri, 12 Mar 2021 14:01:01 +0800 (CST)
From: "(Cron Daemon)" <root@lm.localdomain>
To: root@lm.localdomain
Subject: Cron <root@lm> run-parts /etc/cron.hourly
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=165>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/0>
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>
Message-Id: <20210312060101.488F220BCEB8@lm.localdomain>
Date: Fri, 12 Mar 2021 14:01:01 +0800 (CST)

/etc/cron.hourly/0yum-hourly.cron:

File "/usr/sbin/yum-cron", line 256
except Exception, e:
^
SyntaxError: invalid syntax
[root@lm download]# vim /usr/sbin/yum-cron
[root@lm download]# cat /usr/sbin/yum-cron | head -n 1
#!/usr/bin/python2.7 -tt