python升级2.7.13版本进入环境出现大量信息

来源:互联网 发布:外国人看中国历史知乎 编辑:程序博客网 时间:2024/06/05 00:27

python升级后检测版本出现加载信息
进入和退出python命令窗口都会提示大量信息
[root@python Python-2.7.13]# /usr/local/python2/bin/python2.7 -v

# installing zipimport hookimport zipimport # builtin# installed zipimport hook# /usr/local/python2/lib/python2.7/site.pyc matches /usr/local/python2/lib/python2.7/site.pyimport site # precompiled from /usr/local/python2/lib/python2.7/site.pyc# /usr/local/python2/lib/python2.7/os.pyc matches /usr/local/python2/lib/python2.7/os.pyimport os # precompiled from /usr/local/python2/lib/python2.7/os.pycimport errno # builtinimport posix # builtin# /usr/local/python2/lib/python2.7/posixpath.pyc matches /usr/local/python2/lib/python2.7/posixpath.pyimport posixpath # precompiled from /usr/local/python2/lib/python2.7/posixpath.pyc# /usr/local/python2/lib/python2.7/stat.pyc matches /usr/local/python2/lib/python2.7/stat.pyimport stat # precompiled from /usr/local/python2/lib/python2.7/stat.pyc# /usr/local/python2/lib/python2.7/genericpath.pyc matches /usr/local/python2/lib/python2.7/genericpath.pyimport genericpath # precompiled from /usr/local/python2/lib/python2.7/genericpath.pyc# /usr/local/python2/lib/python2.7/warnings.pyc matches /usr/local/python2/lib/python2.7/warnings.pyimport warnings # precompiled from /usr/local/python2/lib/python2.7/warnings.pyc# /usr/local/python2/lib/python2.7/linecache.pyc matches /usr/local/python2/lib/python2.7/linecache.pyimport linecache # precompiled from /usr/local/python2/lib/python2.7/linecache.pyc# /usr/local/python2/lib/python2.7/types.pyc matches /usr/local/python2/lib/python2.7/types.pyimport types # precompiled from /usr/local/python2/lib/python2.7/types.pyc# /usr/local/python2/lib/python2.7/UserDict.pyc matches /usr/local/python2/lib/python2.7/UserDict.pyimport UserDict # precompiled from /usr/local/python2/lib/python2.7/UserDict.pyc# /usr/local/python2/lib/python2.7/_abcoll.pyc matches /usr/local/python2/lib/python2.7/_abcoll.pyimport _abcoll # precompiled from /usr/local/python2/lib/python2.7/_abcoll.pyc# /usr/local/python2/lib/python2.7/abc.pyc matches /usr/local/python2/lib/python2.7/abc.pyimport abc # precompiled from /usr/local/python2/lib/python2.7/abc.pyc# /usr/local/python2/lib/python2.7/_weakrefset.pyc matches /usr/local/python2/lib/python2.7/_weakrefset.pyimport _weakrefset # precompiled from /usr/local/python2/lib/python2.7/_weakrefset.pycimport _weakref # builtin# /usr/local/python2/lib/python2.7/copy_reg.pyc matches /usr/local/python2/lib/python2.7/copy_reg.pyimport copy_reg # precompiled from /usr/local/python2/lib/python2.7/copy_reg.pyc# /usr/local/python2/lib/python2.7/traceback.pyc matches /usr/local/python2/lib/python2.7/traceback.pyimport traceback # precompiled from /usr/local/python2/lib/python2.7/traceback.pyc# /usr/local/python2/lib/python2.7/sysconfig.pyc matches /usr/local/python2/lib/python2.7/sysconfig.pyimport sysconfig # precompiled from /usr/local/python2/lib/python2.7/sysconfig.pyc# /usr/local/python2/lib/python2.7/re.pyc matches /usr/local/python2/lib/python2.7/re.pyimport re # precompiled from /usr/local/python2/lib/python2.7/re.pyc# /usr/local/python2/lib/python2.7/sre_compile.pyc matches /usr/local/python2/lib/python2.7/sre_compile.pyimport sre_compile # precompiled from /usr/local/python2/lib/python2.7/sre_compile.pycimport _sre # builtin# /usr/local/python2/lib/python2.7/sre_parse.pyc matches /usr/local/python2/lib/python2.7/sre_parse.pyimport sre_parse # precompiled from /usr/local/python2/lib/python2.7/sre_parse.pyc# /usr/local/python2/lib/python2.7/sre_constants.pyc matches /usr/local/python2/lib/python2.7/sre_constants.pyimport sre_constants # precompiled from /usr/local/python2/lib/python2.7/sre_constants.pycdlopen("/usr/local/python2/lib/python2.7/lib-dynload/_locale.so", 2);import _locale # dynamically loaded from /usr/local/python2/lib/python2.7/lib-dynload/_locale.so# /usr/local/python2/lib/python2.7/_sysconfigdata.pyc matches /usr/local/python2/lib/python2.7/_sysconfigdata.pyimport _sysconfigdata # precompiled from /usr/local/python2/lib/python2.7/_sysconfigdata.pycimport encodings # directory /usr/local/python2/lib/python2.7/encodings# /usr/local/python2/lib/python2.7/encodings/__init__.pyc matches /usr/local/python2/lib/python2.7/encodings/__init__.pyimport encodings # precompiled from /usr/local/python2/lib/python2.7/encodings/__init__.pyc# /usr/local/python2/lib/python2.7/codecs.pyc matches /usr/local/python2/lib/python2.7/codecs.pyimport codecs # precompiled from /usr/local/python2/lib/python2.7/codecs.pycimport _codecs # builtin# /usr/local/python2/lib/python2.7/encodings/aliases.pyc matches /usr/local/python2/lib/python2.7/encodings/aliases.pyimport encodings.aliases # precompiled from /usr/local/python2/lib/python2.7/encodings/aliases.pyc# /usr/local/python2/lib/python2.7/encodings/utf_8.pyc matches /usr/local/python2/lib/python2.7/encodings/utf_8.pyimport encodings.utf_8 # precompiled from /usr/local/python2/lib/python2.7/encodings/utf_8.pycPython 2.7.13 (default, Jun 17 2017, 16:24:20) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>>

python环境退出提示如下

**>>> exit()**# clear __builtin__._# clear sys.path# clear sys.argv# clear sys.ps1# clear sys.ps2# clear sys.exitfunc# clear sys.exc_type# clear sys.exc_value# clear sys.exc_traceback# clear sys.last_type# clear sys.last_value# clear sys.last_traceback# clear sys.path_hooks# clear sys.path_importer_cache# clear sys.meta_path# clear sys.flags# clear sys.float_info# restore sys.stdin# restore sys.stdout# restore sys.stderr# cleanup __main__# cleanup[1] encodings# cleanup[1] site# cleanup[1] sysconfig# cleanup[1] abc# cleanup[1] _weakrefset# cleanup[1] sre_constants# cleanup[1] re# cleanup[1] _codecs# cleanup[1] _warnings# cleanup[1] zipimport# cleanup[1] _sysconfigdata# cleanup[1] encodings.utf_8# cleanup[1] codecs# cleanup[1] _locale# cleanup[1] signal# cleanup[1] traceback# cleanup[1] posix# cleanup[1] encodings.aliases# cleanup[1] exceptions# cleanup[1] _weakref# cleanup[1] sre_compile# cleanup[1] _sre# cleanup[1] sre_parse# cleanup[2] copy_reg# cleanup[2] posixpath# cleanup[2] errno# cleanup[2] _abcoll# cleanup[2] types# cleanup[2] genericpath# cleanup[2] stat# cleanup[2] warnings# cleanup[2] UserDict# cleanup[2] os.path# cleanup[2] linecache# cleanup[2] os# cleanup sys# cleanup __builtin__# cleanup ints: 19 unfreed ints# cleanup floats

这是由于环境变量的问题导致的
设置环境变量即可

# vim /etc/profile.d/python2.sh
# cat /etc/profile.d/python2.sh

PYTHON_HOME=/usr/local/python2export PATH=$PYTHON_HOME/bin:$PATH