Reputation: 445
In Centos 7 system, what is the default pythonpath enviroment? Before I make any pythonpath setting, the command "echo $PYTHONPATH" gives no output. After I make the following setting:
PYTHONPATH="{$PYTHONPATH}:/usr/lib/python2.7/site-packages:/usr/lib64/python2.7/site-packages/pandas:/app/anaconda2/pkgs"
export PYTHONPATH=$PYTHONPATH:/app/Jade
the command "echo $PYTHONPATH" gives the following output:
:/app/Jade
I don't understand why before "/app/Jade" there is an extra colon (:). And what is the correct way to set PYTHONPATH?
Best regards.
Yeping Sun
Upvotes: 2
Views: 15338
Reputation: 3000
export PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/lib64/python2.7/site-packages/pandas:/app/anaconda2/pkgs:/app/Jade
The problem is in your first one, you included ""
around $PYTHONPATH
.
Secondly, the correct way to do this is:
export PATH=$PATH:/path/to/python
You can do which python
to figure out what your path to Python is.
And then simply to export PYTHONPATH=/app/Jade
<-- this may be incorrect as well since you need to supply this with an absolute path. Unless app
is in your root folder, this won't work.
ALSO if you could copy-paste the exact error you are getting, that would be really helpful to the SO community in helping you, with this post and future posts.
Upvotes: 2
Reputation:
This has nothing to do with $PYTHONPATH
but is a more generally PATH
naming scheme. PATH
is a colon-seperated list.
From What is path?
Thus, for example, to add a directory named /usr/test to a user's PATH variable, it should be appended with a text editor to the line that begins with PATH so that the line reads something like PATH=$PATH:$HOME/bin:/usr/test. It is important that each absolute path be directly (i.e., with no intervening spaces) preceded by a colon.
See more here: Python - PYTHONPATH in linux
Upvotes: 1