linux - Change python path for a specific python install -
i have full python installation files in /usr/local/
, have 1 compiled source sitting in ~/python_dist
. if @ sys.path
on each interpreter see indeed import different libraries.
currently can run $ pythonpath=~/other_py_libs ~/python_dist/bin/python
invoke custom interpreter other modules available in path. however, don't want permanently change global pythonpath
variable.
how can permanently change python path 1 specific python install?
the easiest way use virtualenv (manage virtualenvwrapper). virtual environments can set different, isolated python environments (kind of little python playgrounds). switching between them (with of virtualenvwrapper) easy typing workon envname
. don't have worry switching pythonpath around, , can direct scripts use specific environment running them python install in environment, e.g. using #! /home/myname/.virtualenvs/envname/bin python
.
Comments
Post a Comment