version/compile info - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: version/compile info (/thread-10119.html) Pages:
1
2
|
version/compile info - Skaperen - May-14-2018 when i start up python or python3 with no arguments to get the interactive mode, at first it outputs 2 lines of information and a line of instructions. the 2nd line appears to be compilation information. how can i get all of this information in a python script? i hope the method is the same in both python2 and python3. RE: version/compile info - wavic - May-14-2018 >>> sys.version '3.6.4 (default, Jan 5 2018, 02:35:40) \n[GCC 7.2.1 20171224]' RE: version/compile info - Skaperen - May-14-2018 what did you get as a banner when you started python? is it the same? apparently these two versions of Python were compiled on different hosts. i'm assuming that's what "linux" and "linux2" mean (maybe not). if anyone has Python on a different architecture, maybe they can show what they have.
RE: version/compile info - wavic - May-14-2018 (May-14-2018, 05:11 AM)Skaperen Wrote: what did you get as a banner when you started python? is it the same? Python 3.6.4 (default, Jan 5 2018, 02:35:40) [GCC 7.2.1 20171224] on linux Type "help", "copyright", "credits" or "license" for more information. I would say yes. Without the last line. RE: version/compile info - DeaD_EyE - May-14-2018 print('Python ' + sys.version) RE: version/compile info - ljmetzger - May-14-2018 According to the 2nd reference below in Python 3 documentation: Quote:sys.version platform.python_version() Reference: https://docs.python.org/3/library/platform.html?highlight=platform%20python_version#platform.python_version sys.version Reference: https://docs.python.org/3/library/sys.html?highlight=sys%20version#sys.version sys.version_info Reference: https://docs.python.org/3/library/sys.html?highlight=sys%20version_info#sys.version_info The following code works in both Python 2 and Python 3: import platform import sys print("platform.python_version(): {}".format(platform.python_version())) print("sys.version: {}".format(sys.version)) print("sys.version_info: {}".format(sys.version_info)) print("sys.version_info.major: {}".format(sys.version_info.major)) Lewis
RE: version/compile info - ljmetzger - May-14-2018 Quote:Skaperen Wrote: Windows 10 - 32 bit Python: Lewis
RE: version/compile info - Skaperen - May-17-2018 (May-14-2018, 02:39 PM)ljmetzger Wrote:does sys.version include "win32" for you?Quote:Skaperen Wrote: RE: version/compile info - ljmetzger - May-17-2018 Quote:Skaperen Wrote: 64 bit Windows 10 - 32 bit Python 'win32' is returned by sys.platform import platform import sys print("platform.python_version(): {}".format(platform.python_version())) print("platform.platform(): {}".format(platform.platform())) print("platform.uname(): {}".format(platform.uname())) print("platform.system(): {}".format(platform.system())) print("platform.release(): {}".format(platform.release())) print("platform.version(): {}".format(platform.version())) system = platform.system() release = platform.release() version = platform.version() print("platform.system_alias(system, release, version): {}".format(platform.system_alias(system, release, version))) print("") print("sys.platform: {}".format(sys.platform)) print("sys.version: {}".format(sys.version)) print("sys.version_info: {}".format(sys.version_info)) print("sys.version_info.major: {}".format(sys.version_info.major)) Lewis
RE: version/compile info - Skaperen - May-19-2018 so that's where it comes from. what does the "2" mean if python3 does not have it?
|