In ubuntu linux if we want to set up python path we do something like this:
export PYTHONPATH=/etc ...
Now, how I would know what the current path I have?
4 Answers 4
You can type which python on the ubuntu terminal and it will give the Python installed location path.
Comments
First, I hope you don't really set PYTHONPATH=/etc, /etc is for configuration files, not python libraries.
You can see what an environment variable is set to by using echo, e.g.: echo $PYTHONPATH. If the variable has not been set it will be blank. You can also use env to get a list of all environment variables, and couple with grep to see if a particular one is set, e.g. env | grep PYTHONPATH.
1 Comment
/etc .use printenv command, it will print all the environment variables, to only print PYTHONPATH use: printenv PYTHONPATH
Comments
Command:
which python
gives path to python
as:
which python3
gives python3 path
printenv PYTHONPATH?