Setup Python3 Development Environment on Mac

0

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 https://raw.githubusercontent.com/Homebrew/install/master/install)”

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.

References
1. http://python-guide-pt-br.readthedocs.io/en/latest/starting/install3/osx/
2. http://machinelearningmastery.com/install-python-3-environment-mac-os-x-machine-learning-deep-learning/
3. https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-macos

Share.

About Author

A QA guy who is trying to learn some dev's skills as well as English by blogging his development notes in English. Hey, please let me know if you see any spelling mistake or I should write things in another better way.