查看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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM