Creating Virtual Enivironment



Creating Python virtualenv in Windows

FIrst go to Path You want install VE

C:\Users\venkatasivaramireddy>cd Desktop

C:\Users\venkatasivaramireddy\Desktop>cd

C:\Users\venkatasivaramireddy\Desktop>cd django-google-maps-master

C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master>virtualenv env

C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master>virtualenv --version
16.7.9

C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master>cd env

C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master\env>cd Scripts

C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master\env\Scripts>activate

(env) C:\Users\venkatasivaramireddy\Desktop\django-google-maps-master\env\Scripts> pip install -r requirement.txt

 
.......................................................
If python is installed in your system, then pip comes in handy.
So simple steps are:
1) Install virtualenv using

 > pip install virtualenv 
2)Now in which ever directory you are, this line below will create a virtualenv there
 > virtualenv myenv
And here also you can name it anything.
3) Now if you are same directory then type,
 > myenv\Scripts\activate
You can explicitly specify your path too.
Similarly like Linux you can deactivate it like
$ deactivate





Creating virtual environment in Linux
If pip is not in your system


$ sudo apt-get install python-pip
Then install virtualenv
$ pip install virtualenv
Now check your installation
$ virtualenv --version
Create a virtual environment now,
$ virtualenv virtualenv_name
After this command, a folder named virtualenv_name will be created. You can name anything to it. If you want to create a virtualenv for specific python version, type
$ virtualenv -p /usr/bin/python3 virtualenv_name
or
$ virtualenv -p /usr/bin/python2.7 virtualenv_name
Now at last we just need to activate it, using command
$ source virtualenv_name/bin/activate
Now you are in a Python virtual environment
You can deactivate using
$ deactivate

Comments

Popular posts from this blog

ERR: error parsing query: found influx, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line

How To Convert Html File/URL/String Into Image Using Python

How to get Full URL or get absolute url In Django