Codementor Events

Set Up your Python Development Environment

Published Oct 20, 2017
Set Up your Python Development Environment

Almost every Operating System today is shipped with Python by default. There is still time, though, until Windows users will have that facility. In any case, this installed Python is necessary for the internal functionalities of the OS and should be played around with.

For an aspiring Python developer, a recommended method is to install your own version of Python in its system. You can use the Operating System's default package manager to install your favorite or recommended version of Python.

There are two major versions of Python — Python2 and Python3.

Python3 is the latest version of Python and is the recommended version to use if you've just started learning Python. If you're following Udacity, CodeAcademy, or Codeschool courses, keep in mind that these course materials use Python2. In that case, it's best to stick to Python2 for learning. Once you're acquainted with Python and it's ecosystem, you should make a switch to Python3. It's not too hard to switch 😃

MacOSX

If you're just setting up your programming environment, you might need to install the "Homebrew" package manager for Mac. It is a program used to install packages in OSX.

Open your Terminal app and paste the following command in it. This should set up Homebrew for you.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

You can check whether Homebrew is installed properly or not by running the following command. (Your version of brew might be newer than the output shown here.)

brew --version
Homebrew 1.3.4
Homebrew/homebrew-core (git revision e395a; last commit 2017-10-05)

Time to install Python using Homebrew.

Open your terminal and type the following command to install Python.

brew install python python3

Once the installation is complete, you should have both Python2 and Python3 version available, as python and python3 respectively.

How do I check what version of Python is installed.

You can determine it using the which command in your favorite terminal.

which python
/usr/local/bin/python
which python3
/usr/local/bin/python3

In future articles, I will write more about virtualenvs ('virtual environments') in Python and its usage.

Stay tuned!

Discover and read more posts from Priyank Trivedi
get started