Setting Up Virtual Environment

Noah Alorwu
1 min readDec 3, 2018

I assumed you have Python installed and want to set up a virtual environment in order to start a project. Below are ways you can get started on different platforms:

Note: myven :- virtual environment name

Windows
Open CMD
Change Directory to your project directory
> cd project_directory
> python -m venv myven
> myven\scripts\activate

Linux/MacOS
Open Terminal /Console
$ sudo apt-get install virtualenv
#creating the virtual environment
$ virtualenv myven
#You can also use a Python interpreter of your choice
$ virtualenv -p /usr/bin/python2.7 myven
$ source myven/bin/activate

Ouch! So you tried creating your venv and then you encountered this error on your terminal 👉 The path python2 (from — python=python) does not exist
Do the following:
sudo apt-get update
sudo apt install python
When done go back to creating the virtual environment!

To deactivate virtual environment
> deactivate
$ deactivate

--

--

Noah Alorwu

Software Engineer / UI Designer / PSF Fellow / DSF Member / Community Builder / Wikimedian In Residence