Python Environment : A Beginner Tutorial — Part 1

Martin Manullang
3 min readAug 23, 2021

--

This time, I will try to explain the python environment, its uses, and how to use it primarily and straightforwardly. This tutorial is perfect for beginners who want to learn software development with python and have to deal with many dependencies or python packages that are specifically run on specific python versions.

This guide was tested on the macOS Big Sur operating system and Terminal (if you are using linux, please adjust some parts)

The Outline

The Introduction

What is Python ?

The sentence below defines Python as an interpreted, object-oriented, high-level programming language with dynamic semantics. Using the advanced built-in data structures and dynamic typing, as well as dynamic binding, Rapid Application Development and as a scripting or glue language for connecting existing components together are among the attractive features of the language.

Why Python ?

Python is a particularly accessible programming language due to its simple syntax and the fact that it doesn’t require more complex expressions.

Over the last several years, Python has experienced huge growth and attention. According to StackOverflow, Python is predicted to be the fastest-growing programming language in the world by 2020.

The Python libraries are great, enabling you to identify and save your time and effort throughout the first development cycle.

Regardless of the type of environment you are in, there will be no performance degradation due to the usage of Python.

Python is the second most popular data science and analytics language, behind R.

Due to Python’s availability in the development industry, it is one of the preferred programming languages for programmers and students.

Because of its many uses in Artificial Intelligence, Deep Learning, and Data Science, Python is now seen as the most essential programming language in schools and universities.

What is Virtual Environment ?

A virtual environment is a Python environment so that (by default) any libraries installed in a “system” Python (i.e., one which is installed as part of your operating system), are separated from those installed in other virtual environments.

Why Using Virtual Environment ?

Python packages may be managed using a virtual environment. You may avoid the issue of Python packages installing globally and potentially breaking system tools or other projects by using virtual environments.

What is Pyenv ?

Previously known as Pythonbrew, Pyenv is a simple Python version management application. With Pyenv, you may manage several versions of Python and switch between them, as well as define environment-specific directories for Python.

Installation Process

The Installation Tutorial

A. Install Dependencies

Xcode Command Line, Homebrew, openssl, readline, sqlite3, xz, zlib

  • First, you have to install xcode command line tool. The installation is very easy, just type the code below on the terminal and click install on the prompt out menu.
xcode-select — install
  • Then, you have to install homebrew. Type the command below on your terminal. (Reference)
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • To make sure that homebrew is installed, type “brew help” in the terminal. If a message appears from help and there are no errors, then homebrew has been installed.
  • Then install the other dependencies (openssl, readline, sqlite3, xz, zlib) by using the command below on terminal :
brew install openssl readline sqlite3 xz zlib

That’s all :)

B. Installing Pyenv

The easiest way is just by running the command below on your terminal:

curl https://pyenv.run | bash

After the installation finished, run this command on your terminal :

exec $SHELL

Due to limited writing time, tutorials and usage examples will be continued in part 2 of this article. I apologize.

--

--

Martin Manullang

Lifetime Learner. Write about my restlessness | Computer Engineering Ph.D. student | about me : https://mctm.me