Python install location and version

Have you ever wondered how to check the install path of python and it’s version ? If you have then this post is for you. It is very easy to check the version and install location of python on linux as well as on windows. First I will show the method of checking this on linux and then on windows.

1. On linux just type these two commands in the terminal:

# for python install path
root@bt:/$ which python

# for python version;
root@bt:/usr/bin$ python -V
Python 2.7.5

2. On windows type this commands in the command prompt for python version:

python -V

And type these commands in the python shell for python install path

>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)

This comes in handy when you need to know the version and path of python real quick. I hope you liked today’s post. Stay tuned for the next one. Do share your views in the comments below.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s