Issue background
Python programming on Mac Book Pro requires a different Python environment to be used in different projects due to the installation of Python2 and PYTHON3 environments, which requires switching between the two environments.
System Configuration
- Mac OS Yosemite 10.10.3 (14d136)
- python2.7.9 python3.4.3
Solution Solutions
- Installing homebrew
- Installing Python2 and Python3 using homebrew
- Installing Virtualenv
- Create a virtual environment using VIRTUALENV
- Activating a virtual environment
Installing homebrew
Https://github.com/Homebrew/homebrew
Installing Python2 and Python3 using homebrew
$brew Install Python
$brew Install Python3
Installing Virtualenv
The corresponding version of VIRTUALENV will be installed automatically during the brew installation Python version two
Create a virtual environment using VIRTUALENV
http://simononsoftware.com/virtualenv-tutorial/
Create a working directory
mkdir virt_env
Create a virtual environment on the working directory
Virtualenv virt_env/virt1–python=python3.4.3
Or
Virtualenv virt_env/virt1–python=python2.7.9
Activating a virtual environment
SOURCE Virt_env/virt1/bin/activate
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Switching python2 and Python3 environments on MAC OS