Setup Python3 Development Environment on Mac


By default, you do not need to install or configure anything else to use Python 2. This article is aimed to serve as a shortcut or references on how to setup Python3 Development Environment. Basically you will need to install the following:

1. XCode & XCode Command Line Tools

You can download and install XCode from AppStore. XCode is free and is at least 4.5 GB in size and may take some time to download (must have an Apple account).

To install Command Line Tools, you can issue below command “xcode-select –install”

2. Install and Setup Homebrew

Type below command on Terminal

/usr/bin/ruby -e “$(curl -fsSL”

Once above installation completes, we’ll set PATH environment variable for Homebrew:

nano ~/.bash_profile
# Add the following
export PATH=”/usr/local/sbin:$PATH”

On Terminal, type below command to activate changes

source ~/.bash_profile

To check if it works, type

brew doctor
# And you should get: Your system is ready to brew.

3. Install Python3

Simply type below command on Terminal. Along with Python3, Homebrew will install pip, setuptools and wheel.

brew install python3
# It will take some time. You may want to keep everything updated by typing
brew update
brew upgrade python3

4. Create Virtual Environment

mkdir Environments
cd Environments
python3.6 -m venv my_env
source my_env/bin/activate

Your virtual environment is ready to use.

Wrap up

Congratulations, you have your MAC ready as Python Development Environment. Please leave your comments, ideas or share if you find this article helpful.



About Author

Hien Nguyen is an experienced Software QA Engineer. A tester by day and a blogger by night, Hien has a great passion for software testing, especially complex test automation problems. When not doing all those, he enjoys reading, jogging and trying new things.