Setup Python

This is a simple guide to get started with Python programming language. In this guide, you will learn how to setup Python development environment.

Getting Started With Google Colab

Colab is a free Jupyter notebook environment provided by Google. It is a good choice for beginners to learn Python programming language and data science.

You can access Colab by visiting the Colab website.

To start with Python, you need to install Python interpreter, IDE (Integrated Development Environment) and environment management tool. Specifically, this guide will introduce how to install Python, VS Code and Miniconda.

The websites are listed as follows:

Install Python

Windows

Download Python from the official website Python. There are differen versions of Python available. Since the latest version may have some compatibility issues with some packages, it is recommended to install the 3.8 ~ 3.10 version.

Mac

It is recommended to use Homebrew to install Python for Mac users. After installing Homebrew, run the following command to install Python:

brew install python3

Install VS Code

VS Code is a lightweight, popular and powerful code editor. You can download it from the official website VS Code.

Beside of Python, you can also use VS Code to develop other programming languages, such as JavaScript, TypeScript, C++, etc. It is also a good choice for writing LaTeX documents and markdown files.

Install Python Extension

After installing VS Code, it is required to install Python extension to enable Python development. You can find the extension in the Extension Marketplace of VS Code. For more information about Python extension, please visit the here.

Now, you have installed

  • Python interpreter

  • VS Code

  • Python extension for VS Code

The next step is to create a virtual environment.

Install Miniconda

Miniconda can be downloaded from the official website Miniconda. You can download the installer according to your operating system.

Create a Virtual Environment

To create a virtual environment, run the following command:

conda create -n ENV python=3.10

The above command creates a virtual environment named ENV with Python version 3.10. You can replace ENV with your desired environment name.

Activate and Deactivate Virtual Environment

To activate the virtual environment, run the following command:

conda activate ENV

The above command activates the virtual environment named ENV.

To deactivate the virtual environment, run the following command:

conda deactivate

Install Packages

To install packages in the virtual environment, run the following command:

conda install PKGNAME=3.1.4

The above command installs the package PKGNAME with version 3.1.4.

Now, you have learned how to create a virtual environment, activate and deactivate the virtual environment, and install packages in the virtual environment. For more information, you can refer to the official documentation of Conda.

Last updated