File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545-----------------------
4646
4747要手动实现一个上下文管理器,需要你有对类有一些了解,至少需要知道什么是类,怎么定义类。对于类的知识,我放在了第七章,因此你可以先前往学习下第七章的的第一节内容:\ `7.1
48- 类的理解与使用 <https://python.iswbm.com/en/latest/c07/c07_01.html> `__ 。
48+ 类的理解与使用 <https://python.iswbm.com/en/latest/c07/c07_01.html> `__
49+ 。
4950
5051学习了类的基本知识,想要自己实现这样一个上下文管理,就简单了。
5152
Original file line number Diff line number Diff line change @@ -47,7 +47,8 @@ pip 是最主流的包管理方案,使用 ``pip install xxx`` 就可以从 PYP
4747 $ pip install pkg< =2.1.2
4848
4949 更多 pip 的使用方法,可参考本系列教程后面的文章,介绍得非常清楚:\ `8.8
50- pip 的详细使用指南 <https://python.iswbm.com/en/latest/c08/c08_08.html> `__
50+ pip
51+ 的详细使用指南 <https://python.iswbm.com/en/latest/c08/c08_08.html> `__
5152
52533. 使用 pipx
5354------------
Original file line number Diff line number Diff line change 1+ # 9.9 【调试技巧】如何调试已经运行的程序?
2+
3+ 官方原始wiki:https://wiki.python.org/moin/DebuggingWithGdb
4+
5+ 在CentOS 下,安装包过程,官方给的不够详细。这里记录一下
6+
7+ 先安装 yum-utils,装完后就能使用 debuginfo
8+
9+ ``` shell
10+ $ sudo yum install yum-utils
11+ ```
12+
13+ 然后使用debuginfo 安装 glibc,不过在安装之前,有可能 你需要先配置debuginfo的仓库,编辑` /etc/yum.repos.d/CentOS-Debuginfo.repo `
14+
15+ ```
16+ #Debug Info
17+ [debuginfo]
18+ name=CentOS-$releasever - DebugInfo
19+ # CentOS-4
20+ #baseurl=http://debuginfo.centos.org/$releasever/
21+ # CentOS-5
22+ baseurl=http://debuginfo.centos.org/$releasever/$basearch/
23+ gpgcheck=0
24+ enabled=1
25+ # CentOS-4
26+ #gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-$releasever
27+ # CentOS-5
28+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
29+ protect=1
30+ ```
31+
32+ 然后就可以安装 ` glibc ` 了。
33+
34+ ``` shell
35+ $ yum --nogpgcheck --enablerepo=debuginfo install glibc-debuginfo
36+ $ sudo debuginfo-install glibc
37+ ```
38+
39+ 最后安装 ` python-debuginfo `
40+
41+ ``` shell
42+ $ sudo yum install gdb python-debuginfo
43+ ```
44+
45+
46+
47+
48+
Original file line number Diff line number Diff line change 1+ 9.9 【调试技巧】如何调试已经运行的程序?
2+ ========================================
3+
4+ 官方原始wiki:https://wiki.python.org/moin/DebuggingWithGdb
5+
6+ 在CentOS 下,安装包过程,官方给的不够详细。这里记录一下
7+
8+ 先安装 yum-utils,装完后就能使用 debuginfo
9+
10+ .. code :: shell
11+
12+ $ sudo yum install yum-utils
13+
14+ 然后使用debuginfo 安装 glibc,不过在安装之前,有可能
15+ 你需要先配置debuginfo的仓库,编辑\ ``/etc/yum.repos.d/CentOS-Debuginfo.repo ``
16+
17+ ::
18+
19+ #Debug Info
20+ [debuginfo]
21+ name=CentOS-$releasever - DebugInfo
22+ # CentOS-4
23+ #baseurl=http://debuginfo.centos.org/$releasever/
24+ # CentOS-5
25+ baseurl=http://debuginfo.centos.org/$releasever/$basearch/
26+ gpgcheck=0
27+ enabled=1
28+ # CentOS-4
29+ #gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-$releasever
30+ # CentOS-5
31+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
32+ protect=1
33+
34+ 然后就可以安装 ``glibc `` 了。
35+
36+ .. code :: shell
37+
38+ $ yum --nogpgcheck --enablerepo=debuginfo install glibc-debuginfo
39+ $ sudo debuginfo-install glibc
40+
41+ 最后安装 ``python-debuginfo ``
42+
43+ .. code :: shell
44+
45+ $ sudo yum install gdb python-debuginfo
You can’t perform that action at this time.
0 commit comments