Python 2 与 Python 3 的安装路径
/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python3.5/dist-packages
yongqiang@famu-sys:/usr/local/lib/python2.7/dist-packages$ pwd
/usr/local/lib/python2.7/dist-packages
yongqiang@famu-sys:/usr/local/lib/python2.7/dist-packages$
yongqiang@famu-sys:/usr/local/lib/python3.5/dist-packages$ pwd
/usr/local/lib/python3.5/dist-packages
yongqiang@famu-sys:/usr/local/lib/python3.5/dist-packages$
yongqiang@famu-sys:~$ cd /usr/local/lib/
yongqiang@famu-sys:/usr/local/lib$ ll
总用量 16
drwxr-xr-x 4 root root 4096 3月 1 2018 ./
drwxr-xr-x 12 root root 4096 7月 18 20:51 ../
drwxrwsr-x 4 root staff 4096 3月 1 2018 python2.7/
drwxrwsr-x 3 root staff 4096 3月 1 2018 python3.5/
yongqiang@famu-sys:/usr/local/lib$
yongqiang@famu-sys:/usr/local/lib$ ll ./python2.7/
总用量 16
drwxrwsr-x 4 root staff 4096 3月 1 2018 ./
drwxr-xr-x 4 root root 4096 3月 1 2018 ../
drwxrwsr-x 104 root staff 4096 11月 18 10:42 dist-packages/
drwxrwsr-x 2 root staff 4096 3月 1 2018 site-packages/
yongqiang@famu-sys:/usr/local/lib$
yongqiang@famu-sys:/usr/local/lib$ ll ./python3.5/
总用量 12
drwxrwsr-x 3 root staff 4096 3月 1 2018 ./
drwxr-xr-x 4 root root 4096 3月 1 2018 ../
drwxrwsr-x 63 root staff 4096 11月 18 10:42 dist-packages/
yongqiang@famu-sys:/usr/local/lib$
yongqiang@famu-sys:~$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
/usr/bin/python
>>> exit()
yongqiang@famu-sys:~$
yongqiang@famu-sys:~$ python3
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.executable)
/usr/bin/python3
>>> exit()
yongqiang@famu-sys:~$
- logging - Logging facility for Python
https://docs.python.org/3/library/logging.html
This module defines functions and classes which implement a flexible event logging system for applications and libraries.
日志系统
(base) yongqiang@yongqiang:~$ python
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>> logging.warning('Watch out!')
WARNING:root:Watch out!
>>>
>>> exit()
(base) yongqiang@yongqiang:~$
- concurrent.futures - Launching parallel tasks
https://python.readthedocs.io/en/stable/library/concurrent.futures.html
The concurrent.futures module provides a high-level interface for asynchronously executing callables.
concurrent.futures 模块提供异步执行可调用对象高层接口。