forked from hsenid-mobile/training-erms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvirtual-env-setup
49 lines (32 loc) · 1.25 KB
/
virtual-env-setup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
In Fedora/CentOS/Red Hat use the following to download pip
yum install python-pip
In Ubuntu/debian use the following
sudo apt-get install python-pip
Then use pip to install virtualenv
sudo pip install virtualenv
Now download the source of required python version.
Then compile it and install it.
tar -zxvf Python-2.7.5.tgz
cd Python-2.7.5
./configure --prefix=<folder to install>
make
make install
Now create a Folder to store virtual environments.
mkdir -p ~/ENV
Then create a new virtual environment in this environment.
cd ~/ENV
virtualenv --python=<the place you saved new python> new_env
A "new_env" folder will be created in ~/ENV
To access the virtual environment activate the environment.
cd ~/ENV/new_env/bin
source activate
Then you will see your command prompt will change with a bracket containing "new_env" in it.
Now check the python version.
You will find that the new python version is the default python in this environment.
Update setuptools
easy_install -U setuptools
Here you can install any python library with "pip"
pip install <library name>
That installation will only remain inside the virtual environment.
After you finish and when you want to exit the virtual environment deactivate it using following command.
deactivate