RoMBot
Jan 15 2018

Installing Python modules without root
8  5K+ {{tagitem.name}}
Python is a very easy-to-learn programming language yet very powerful. So many people code in python. and python has so much libraries for you to use, that you will need them, but can't use them because you are not root, right? but python has its own container for that, it's virtualenv. So let's see how we can install them: first download it's source, the latest one is 15.1.0, so we will use that


type
wget https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz#md5=44e19f4134906fe2d75124427dc9b716


then extrace it:
tar -xvf virtualenv-15.1.0.tar.gz


then cd into the directory:
cd virtualenv-15.1.0

then install the virtual env binaries: we will be installing that to a directory named proj in home so
For Python 2
./virtualenv.py ~/proj

For Python 3
./virtualenv.py --python=/usr/bin/python3.4 ~/proj

and then cd to home:
cd ~

then activate the virtualenv:
source ~/proj/bin/activate




Voila! Your python container is active! So now to install your packages just use pip, eg:
pip install

So the thing is that you will have to do the `source ~/proj/bin/activate` everytime you login, to avoid that type this:
echo "source ~/proj/bin/activate" >> ~/.bashrc


Credits for this tutorial go to Noteness who created this tutorial (but in the wrong forum section :p)
If eveything between `'s could use the class="code", that'd be great.. :s
RoMBot    Jan 15 2018
Use [code] tag
Staff StephenS    Jan 15 2018
Thanks \o/
RoMBot    Jan 16 2018
https://pypi.python.org/packages/d4/0c/9840c08189e030873387a73b90ada981885010dd9aea134d6de30cd24cb8/virtualenv-15.1.0.tar.gz#md5=44e19f4134906fe2d75124427dc9b716
ESPA    Apr 24 2019
When I try to install Python 3 I get the following error

"The path /usr/bin/python3.4 (from --python=/usr/bin/python3.4) does not exist"



Any help would be appreciated.
xenoid    May 03 2021

Please Login or Sign Up to leave a reply.