determine where python is running from in linux

4

I normally work in python on Windows and I use the dos command where python to make sure that I am using the virtual environments version of python. What is the equivalent command in the linux shell?

Thanks!

Lance Collins

Posted 2013-04-13T19:58:33.000

Reputation: 143

I think you are looking for command: ps -aux | grep python – Grijesh Chauhan – 2013-04-13T20:01:14.757

Answers

8

Use which python.


$ which python
/usr/bin/python

C:\Users\anossovp>where python
c:\Python27\python.exe

Pavel Anossov

Posted 2013-04-13T19:58:33.000

Reputation: 241

4

The thing you are usually looking for is not where Python itself is, but where it's libraries are. For that I would recommend this:

(from within the Python shell)

import sys
import pprint
pprint.pprint(sys.path)

Outside of that you can still do which python naturally.

Wolph

Posted 2013-04-13T19:58:33.000

Reputation: 595