Your best bet is to use an alias. Open your ~/.bash_aliases
file and type the following:
alias python='/path/to/python/in/your/home/directory'
with the '
. For example, if your python binary file is /home/user/Documents/bin/python
, the alias would be:
alias python='/home/user/Documents/bin/python'
This would not break existing application, since they would continue to use whatever version is /usr/bin/python
or /usr/bin/python3
and you would use the python stored in your home directory.
For easy_install to install modules to a specific directory, you can use the --install-dir
option together with the $PYTHONPATH
environment variable. To do this, do the following:
export PYTHONPATH='/home/user/python/lib/
and then
easy_install --install-dir /home/user/python/lib/ <module_to_install>
or whatever path you want to give to easy_install to install the modules.