Python Virtual Environment on Windows
To create python virtual Environment, first install python from Python Official Website.
After successful installation, add information to Environmental Variables of Windows:
At the end of Path Variable, insert semi-colon (;) and then add path to your Paython Directory and Python Scripts Directory, which may appear like:
C:\Users\<user-name>\AppData\Local\Programs\Python\Python36\;C:\Users\<user-name>\AppData\Local\Programs\Python\Python36\Scripts\
instead of <user-name> enter the name of your windows login user account as shown below:
C:\Users\Azam Rafique\AppData\Local\Programs\Python\Python36\;C:\Users\Azam Rafique\AppData\Local\Programs\Python\Python36\Scripts\
Click Okay to all tabs and close all tabs.
Creating Virtual Environment:
If you already had opened command prompt window, before adding path to environmental variables, please close it and re-open the command prompt.
Now execute the following one by one:
pip install virtualenv Collecting virtualenv Downloading https://files.pythonhosted.org/packages/7c/17/9b7b6cddfd255388b58c61e25b091047f6814183e1d63741c8df8dcd65a2/virtualenv-16.1.0-py2.py3-none-any.whl (1.9MB) 100% |████████████████████████████████| 1.9MB 42kB/s Installing collected packages: virtualenv Successfully installed virtualenv-16.1.0
pip install virtualenvwrapper Collecting virtualenvwrapper Downloading https://files.pythonhosted.org/packages/2b/8c/3192e10913ad945c0f0fcb17e9b2679434a28ad58ee31ce0104cba3b1154/virtualenvwrapper-4.8.2-py2.py3-none-any.whl Collecting virtualenv-clone (from virtualenvwrapper) Downloading https://files.pythonhosted.org/packages/16/9d/6419a4f0fe4350db7fdc01e9d22e949779b6f2d2650e4884aa8aededc5ae/virtualenv_clone-0.4.0-py2.py3-none-any.whl Requirement already satisfied: virtualenv in c:\users\azam rafique\appdata\local\programs\python\python36\lib\site-packages (from virtualenvwrapper) (16.1.0) Collecting stevedore (from virtualenvwrapper) Downloading https://files.pythonhosted.org/packages/35/fa/8683fab2a6e15ecfe107996e56fab91e52fe3ec0b40ca9440a0e1ffe6892/stevedore-1.30.0-py2.py3-none-any.whl (42kB) 100% |████████████████████████████████| 51kB 83kB/s Collecting pbr!=2.1.0,>=2.0.0 (from stevedore->virtualenvwrapper) Downloading https://files.pythonhosted.org/packages/f3/04/fddc1c2dd75b256eda4d360024692231a2c19a0c61ad7f4a162407c1ab58/pbr-5.1.1-py2.py3-none-any.whl (106kB) 100% |████████████████████████████████| 112kB 49kB/s Collecting six>=1.10.0 (from stevedore->virtualenvwrapper) Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Installing collected packages: virtualenv-clone, pbr, six, stevedore, virtualenvwrapper Successfully installed pbr-5.1.1 six-1.11.0 stevedore-1.30.0 virtualenv-clone-0.4.0 virtualenvwrapper-4.8.2
pip install virtualenvwrapper-win Collecting virtualenvwrapper-win Downloading https://files.pythonhosted.org/packages/f5/23/4cba98733b9122219ce67177d745e4984b524b867cf3728eaa807ea21919/virtualenvwrapper-win-1.2.5.tar.gz Requirement already satisfied: virtualenv in c:\users\azam rafique\appdata\local\programs\python\python36\lib\site-packages (from virtualenvwrapper-win) (16.1.0) Installing collected packages: virtualenvwrapper-win Running setup.py install for virtualenvwrapper-win ... done Successfully installed virtualenvwrapper-win-1.2.5
mkvirtualenv py3 Using base prefix 'c:\\users\\azam rafique\\appdata\\local\\programs\\python\\python36' New python executable in C:\Users\AZAMRA~1\Envs\py3\Scripts\python.exe Installing setuptools, pip, wheel... done.
Where py3 is the name of virtual environment.
if Virtual Environment is not already activated, you can activate it by executing:
workon py3
And you are done with installing virtual Environment.