How to install Python on Windows, Linux, and macOS

If you want to get into development, one of my favorite programming languages ‚Äč‚Äčthat I have learned is Python. It is a multiparadigm language that supports imperative, functional, procedural, and object-oriented programming. It is very open and can be used for just about anything, and is a go-to language for many when working on artificial intelligence or machine learning. I use it for a lot of automation, and it’s even the language some of the test tools we’ve used are written in.

Python is a powerful language, and if you want to get started with it, this guide will teach you the basics. Not only will you need to install the python binaries and make sure it’s on your PATH, but you’ll also need something to write the code with. You could use a full IDE (Integrated Development Environment) like PyCharm, or you could go for a text editor like the pre-installed IDLE or Sublime Text 3. There are plenty of options, but this guide should help you with the basics.

Python installation

On Windows and macOS

Installing Python is the easy part, and you’ll need to decide whether to install Python 2.7 or Python 3.x. Python 2.7 is often used for legacy projects, but if you’re writing your own software, you should install Python 3.x.

To install on Windows or Mac, do the following:

  • Go to the official Python site and navigate to the latest version. At the time of writing, that’s 3.10.6.
  • Download the binary for your platform.
  • Run the binary.

You don’t need to select any options besides adding Python to your PATH, as the default installer has everything you need. Simply clicking “Install” is all you need to do. On Mac this will be done by default in the dmg installer.


python installer dialog

Installing Python on Linux

However, if you are using Linux, then it will depend on the distribution you are using. Debian-based distributions (such as Ubuntu) can use the apt package installer in Terminal by running the following command:

  • apt-get install python3.6

Other distributions may already have it pre-installed, and if not, you’ll need to use the package manager on your distribution. For example, on CentOS, you would run “yum install -y python3”.

Verify installation

You can verify that your installation is active by running the “python” command in PowerShell, the command prompt, or your Terminal.

python command run at command prompt


Choose your Python IDE

You’ll need an IDE or text editor to write code effectively, and there are a few options. Python comes with IDLE pre-installed, and while it works fine, it’s not ideal for larger files that can be more complicated. These are some of the IDEs I’ve used for Python over the years, both in college and on my own projects. All of these IDEs are cross-platform, meaning you can run them on Windows, Linux, or macOS.

PyCharm

PyCharm IDE

If you are familiar with Android Studio or IntelliJ, then you are already familiar with PyCharm. It’s from the same developers, and you can even enable the exact same functionality in IntelliJ by installing the Python plugin. The difference is that PyCharm is built from the ground up exclusively for Python, and contains all the features you’d expect from any modern IDE. That includes built-in version control, syntax highlighting, window splitting, debugging features, and more.

Download PyCharm

spy

Spyder IDE

If you’re a data scientist (or going to be using Python for data science purposes), then you need to install Spyder. It is an IDE that includes some of the most popular data analysis packages for Python. These include matplotlib, numpy, scipy, and pandas. If you want to get into data analysis, data plotting, and other scientific research, Spyder is 100% what you need to install. Spyder even has built-in Jupyter Notebooks, which can be used to explore and plot data very easily.

Download Spyder

sublime text 3

sublime text 3

Sublime Text 3 is one of my favorite text editors, simply because of its simplicity. It’s super versatile, yet basic, and best suited for smaller projects. If you’re only working with a few hundred lines of code in a program you’re writing, then Sublime Text 3 is probably the best way to go. I once wrote a web scraper in Python that read local rental sites and emailed me and a few friends a link to new listings just using Sublime Text 3 and Python. It’s a perfectly capable development environment and I think most people should be familiar with it.

Download Sublime Text 3

Visual Studio Code (VSCode)

visual studio python code

Visual Studio Code (or VSCode) is one of the most versatile development environments out there. It’s completely customizable, with a massive repository of plugins that you can access from within. It doesn’t support Python out of the box, but you can install a Python plugin from within that will enable syntax highlighting, smart code completion, Jupyter Notebooks, debugging, unit tests, and other features. I love Visual Studio Code, and in fact, it’s the IDE I use the most when working on something complex.

Download Visual Studio Code


Whats Next

If you want to get started with development, there are plenty of tutorials online that will teach you the basics. Between the likes of CodeAcademy and w3schools, there are plenty of options. There are even Python interpreters on Android that you can use to type on your phone, and the best way to learn is by doing. However, if you’re doing something that’s resource-intensive and may use a lot of machine learning or artificial intelligence models, you might need one of the best laptops to handle it.

The best way I learned was by noticing a problem or other difficulty I was having and trying to find a way to automate the solution. That’s why I got the idea to write a program that would scrape rental sites for me, and I’m sure there are other reasons you may find you want to use Python too.

Leave a Comment