查看python的安装版本,位数及安装路径

一、想要查看ubuntu中安装的Python路径

方法一:whereis python (用来快速查找任何文件,是一个文件搜索命令,与locate的功能一样。执行whereis python 会将所有带有passwd字样的文件路径都列举出来。

方法二:which python (which命令是查找某个命令的完整路径,用来查找可执行文件(二进制文件),which命令的原理是在当前登录用户的PATH环境变量记录的路径中进行查找。执行which python只会列出二进制文件路径)

  • whereis python
  • 输出:python: /usr/bin/python2.7 /usr/bin/python /usr/bin/python2.7-config /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz
  • which python
  • 输出:/usr/bin/python

二、获取当前安装的python是32位还是64位

import platform

platform.architecture() #输出('64bit', 'ELF')

或者使用 python -c "import platform;print platform.architecture()"

参考:https://blog.csdn.net/helloxiaozhe/article/details/80667505

猜你喜欢

转载自www.cnblogs.com/mianbaoshu/p/13367868.html