大数据 爬虫Python AI SqlPython自动流程化高效率工作博士生的科研感悟和生活沉淀

2019-08-28 【高效Python】(1)知道你用的Pyt

2019-08-28  本文已影响0人  Shalom小白

在命令行查看Python版本:

python —V

或者

python3 —V

或者

import sys
print(sys.version_info)
print(sys.version)

例子

在我电脑命令行上出来的结果依次为:

➜  ~ python2 -V
Python 2.7.10
➜  ~ python3 -V
Python 3.7.4

进入python3下面:

➜  ~ python3
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version_info)
sys.version_info(major=3, minor=7, micro=4, releaselevel='final', serial=0)
>>> print(sys.version)
3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)]

进入python2下面:

➜  ~ python2
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.version_info)
sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
>>> print(sys.version)
2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)]

注意事项

上一篇下一篇

猜你喜欢

热点阅读