Hi I'm new to ubuntu and I have the following problem:

I'm aware that ubuntu comes with a python version, but I'm running in a web host and I don't have the sudo command and I only have access to my /home/user

I installed python 2.7.5 on my home, but when I try to do the easy_install command, it goes to /usr/bin/python

How can I do to use the python installed on my /home and not the one in the /usr/bin/?

1 Answer 1


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.

  • Thanks, this solve my problem, but another one appeared because I would like to use easy_install and this is still going to /user/bin but I'm not sure if the version I have installed of python comes with easy_install, anyway the easy_install it is still going to /usr/bin
    – ocespedes
    Apr 15, 2014 at 22:41
  • @ocespedes: Edited my answer to reflect that.
    – jobin
    Apr 15, 2014 at 22:56
  • Is it /home/user/python_lib/ or /home/user/python/lib/. You have used both in your answer. Moreover, we may also create an alias for easy_install so that we do not need to type that long command everytime.
    – Aditya
    Apr 16, 2014 at 9:09
  • @Aditya: I didn't mean to introduce an ambiguity but the user could create and add any arbitrary folder name. Thanks for pointing that out.
    – jobin
    Apr 16, 2014 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.