I need to install python so I can install pip/fab which do not need root access to run and install things. I'm setting up a vagrant VM environment which needs to run fab as non root to function and I really don't want to sudo everything or start changing permissions.
I know with OSX I can install python with brew which will install python to /usr/local/bin or something and then I can just edit my bash_profile path to look in that directoy first.
Use virtual environments. This allows you to make unlimited amounts of virtual python environments, so you can easily use different sets of packages for different projects. Install the following:
Then:
Then, append the following to your bashrc file:
Then, suppose we want to make a virtual environment called "test-env" we can execute:
To use it:
From within this environment you can then pip install anything (without sudo!).
To exit your virtual environment:
Yes you can do that. You can install python into your home directory. So you don't need to have root permissions but little bit ground work needed to do so. Follow the answer.
Open your terminal , assume you are installing python to your home directory.
Then now, while doing
configure
, you must mention that where you are trying to install it.so like
So right now your python has installed in your home at python named directory. so your system must now that the python which it has to access is over there. So little but bashrc need to be done.
In terminal type: nano ~/.bashrc
Then add as
and save -exit with CTRL+X+Y
then do
Recommended : restart your PC to update the new environment setting we've made.
That's it. Now on wards your system call
python
from your home directory.Source