Virtual environments are isolated working copies of python, which allow you to have different projects environments for each of your projects. Which prevents changes in one project affecting others.
1. Install Xcode
2. Open a terminal window
3. Install Command Line Tools of Xcode
4. Install Homebrew
ruby -e \ “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
5. Install python3
brew install python3
Run the below command to verify your python version.
To begin executing python commands, execute the command below.
6. Install virtualenv and virtualenvwrapper
pip3 install virtualenv virtualenvwrapper
7. Create a folder to store virtual environments
8. Setup virtualenvwrapper by inserting the following at the bottom of .bash_profile
export WORKON_HOME=~/.virtualenvs # point to .virtualenvs directory created above export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 # make sure this is the location of which the python version # you are using is located [which python3] should # give you the location for python3 export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv export VIRTUALENVWRAPPER_VIRTUALENV_ARGS=’––no-site-packages’ source /usr/local/bin/virtualenvwrapper.sh
9. Reload your .bash_profile to reflect changes
10. Create a new virtualenv
Now you are inside of your virtual env. You can confirm this by checking to see if you see your env_name inside parenthesis to the left of your command prompt
To deactivate execute the below command.
Still have issues? Contact us and we will walk you through it step by step.