- 命令行pydoc查看
>>> test:~/home$ pydoc modules #查看所有模块
Please wait a moment while I gather a list of all available modules...
ANSI aptsources htmlentitydefs redis
BaseHTTPServer argparse htmllib reportlab
Bastion array http repr
CDROM asn1crypto httpie reprlib
CGIHTTPServer ast httplib requestbuilder
Canvas asynchat httplib2 requests
CommandNotFound asyncore idna resource
ConfigParser atexit ihooks rexec
Cookie atk imaplib rfc822
Crypto audiodev imghdr rlcompleter
DLFCN audioop imp robotparser
Dialog axi impala runpy
DocXMLRPCServer base64 importlib samba
FSM bcrypt imputil scanext
>>> test:~/home$ pydoc tensorflow # 查看指定模块、例如版本、目录等
mqq@iZ2399o6vfuZ:~/zwshi/kudu/create_kudu_table$ pydoc tensorflow
Help on package tensorflow:
NAME
tensorflow
FILE
/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py
PACKAGE CONTENTS
contrib (package)
core (package)
examples (package)
python (package)
tensorboard (package)
tools (package)
DATA
COMPILER_VERSION = '4.8.4'
GIT_VERSION = 'v1.0.0-rc2-15-g47bba63-dirty'
GRAPH_DEF_VERSION = 21
GRAPH_DEF_VERSION_MIN_CONSUMER = 0
GRAPH_DEF_VERSION_MIN_PRODUCER = 0
QUANTIZED_DTYPES = frozenset([tf.qint8, tf.quint8, tf.qint16, tf.quint...
VERSION = '1.0.0'
__compiler_version__ = '4.8.4'
__git_version__ = 'v1.0.0-rc2-15-g47bba63-dirty'
__version__ = '1.0.0'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0...
- 命令行pip list 查看
test:~/home$ pip list #查看模块和版本 或者 pip freeze
Package Version
---------------------------- ------------------
appdirs 1.4.0
apt-xapian-index 0.45
asn1crypto 0.24.0
bcrypt 3.1.4
bitarray 0.8.1
boto 2.46.1
bz2file 0.98
cffi 1.11.5
chardet 2.0.1
click 6.7
colorama 0.2.5
command-not-found 0.3
cryptography 2.2.2
debtagshw 0.1
decorator 4.3.0
defer 1.0.6
dirspec 13.10
distro-info 0.12
enum34 1.1.6
euca2ools 3.0.1
Flask 0.12.2
Flask-Cors 3.0.2
funcsigs 1.0.2
future 0.16.0
gensim 0.13.4.1
h5py 2.6.0
html5lib 0.999
httpie 0.8.0
httplib2 0.8
- python交互help()查看
>>> help("tensorflow")
Help on package tensorflow:
NAME
tensorflow
FILE
/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py
PACKAGE CONTENTS
contrib (package)
core (package)
examples (package)
python (package)
tensorboard (package)
tools (package)
DATA
COMPILER_VERSION = '4.8.4'
GIT_VERSION = 'v1.0.0-rc2-15-g47bba63-dirty'
GRAPH_DEF_VERSION = 21
GRAPH_DEF_VERSION_MIN_CONSUMER = 0
GRAPH_DEF_VERSION_MIN_PRODUCER = 0
QUANTIZED_DTYPES = frozenset([tf.qint8, tf.quint8, tf.qint16, tf.quint...
VERSION = '1.0.0'
__compiler_version__ = '4.8.4'
__git_version__ = 'v1.0.0-rc2-15-g47bba63-dirty'
__version__ = '1.0.0'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0...
- python交互sys查看
Python中所有加载到内存的模块都放在sys.modules。sys.modules是一个全局字典,字典sys.modules对于加载模块起到了缓冲的作用,当import一个模块时首先会在这个列表中查找是否已经加载了此模块,如果加载了则只是将模块的名字加入到正在调用import的模块的Local名字空间中。当第二次再导入该模块时,python会直接到字典中查找,从而加快了程序运行的速度。件,模块文件可以是py、pyc、pyd,找到后将模块载入内存,并加入到sys.modules中,并将名称导入到当前的Local名字空间。
参考文献
查看python已安装模块的方法小结 https://blog.youkuaiyun.com/healthy_coder/article/details/50546384