Practical Python Projects book is now available! Learn how to implement 12 end-to-end projects to enhance your Python knowledge.
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.
- On linux just type these two commands in the terminal:
# for python install path [email protected]:/$ which python /usr/bin/python # for python version; [email protected]:/usr/bin$ python -V Python 2.7.5
- On windows type this commands in the command prompt for python version:
And type these commands in the python shell for python install path
>>> import os >>> import sys >>> os.path.dirname(sys.executable) 'C:\Python27'
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.