python 检查python的版本号和几个包

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 检查python的版本号和几个包相关的知识,希望对你有一定的参考价值。


import sys

print 'Versions\n'

print 'python', sys.version

try:
    import numpy
    print 'numpy', numpy.__version__
except:
    print 'numpy not installed'

try:
    import matplotlib
    print 'matplotlib', matplotlib.__version__
except:
    print 'matplotlib not installed'

try:
    import scipy
    print 'scipy', scipy.__version__
except:
    print 'scipy not installed'

try:
    import rpy2
    print 'rpy2', rpy2.__version__
except:
    print 'rpy2 not installed'

以上是关于python 检查python的版本号和几个包的主要内容,如果未能解决你的问题,请参考以下文章