last hacked on Aug 14, 2017

# VirtualEnv for Windows Some **windows** machines operate differently than what is described in the docs so I wrote this out to outline using `virtualenv` for **Windows** ## Running Python through command line I am going off of the command prompt for this quick runthrough. Other option is `Powershell`, but I haven't used that so it won't be covered. You should have downloaded `Python3.X` and set the environment path set on your computer. Once you have done so check to see if you did it correctly by running python as such: > python ### Terminal Output Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ## Installing 3rd Party Packages Python utilizes `pip` which should already come installed, the biggest difference I found between **Windows** and Unix is this section. So normally for Unix you would use the following command (I'll use `virtualenv` as an example): > pip install virtualenv But when I utilized this I would get the following error code: 'pip' is not recognized as an internal or external command, operable program or batch file. ## **Windows** way Therefore I googled a lot and found a solution that worked for my **windows** machine! python -m pip install virtualenv ## Creating virtualenv Environment python -m virtualenv venv ## Activating Environment This was the tricky part, when activating you will be using a different file source than Unix machines. Important to note that you will be utilizing backslashes for the directories, which gave me a lot of grievances when trying to activate my virtual environment. > venv\Scripts\activate.bat ### Terminal Output (venv) > Then you do the usual `virtualenv` stuff like (venv) > pip freeze > requirements.txt And to deactivate you simply type: (venv) > deactivate ## Deleting virtualenv The **windows** command to delete the `virtualenv` is: > rmdir /s /q venv ### Notes Important to note that when inside the virtual environment `pip` works using the Unix structure. I may have set up my python wrong for my **windows** machine but finding a workaround for setting up environments and installing packages works so I will leave it as is until someone points out the error of my ways. Success!


Here is virtualenv for Mac & Ubuntu:

keep exploring!

back to all projects