Posts

Showing posts with the label Windows

Windows Virtual Environment in Python

Image
Let's consider a  scenario  where you have multiple  projects on your machine  and all of those are using some  different version  libraries. Let's say  one of your projects uses NumPy 1.18  and another uses NumPy 1.19 so in that  situation  virtual environments  come so handy. Let's see how to create a Virtual Environment on windows using git bash. Open the terminal and go to your python project's root directory and type: python -m venv virtual_environment_name Go to the file Scripts that are added by default with venv: cd .\virtual_environment_name\Scripts Now activate the environment by using the command: source activate This activates the virtual environment, now whatever package you install with pip, will stay inside this virtual environment. You can deactivate the env later on using: deactivate That was it :)