If you ever need to pip install
in a custom directory, for example you want to install jrnl (commandline journal) to /tmp/jrnl (you can change path to a flash drive or a synced directory or something):
#install with
PYTHONUSERBASE=/tmp/jrnl pip install --ignore-installed --user jrnl
#and run with
PYTHONPATH=/tmp/jrnl/lib/python2.7/site-packages/ python /tmp/jrnl/bin/jrnl
.
lil’ explanation:
>installation<
PYTHONUSERBASE=/tmp/jrnl pip install --ignore-installed --user jrnl
PYTHONUSERBASE
= directory where to install
--user
means install to user’s directory (overridden with PYTHONUSERBASE)
--ignore-installed
is not needed if you’re gonna be using on the same machine, it signals to download all the dependencies there too, no matter if they’re already installed on your system
>running<
PYTHONPATH=/tmp/jrnl/lib/python2.7/site-packages/ python /tmp/jrnl/bin/jrnl
PYTHONPATH
= “directory it’s installed in” + “python version” + “/site-packages/”
You can explictly call pip2
and python2
, or pip3
and python3
if you want to specify that, the libraries will install in different subfolders, but bin/
will be overwritten