Quick Links
-
How to install Python on Windows and macOS
-
How to install Python on Linux
-
How to verify installation
If you want to get into development, one of my favorite programming languages is Python. It’s a multi-paradigm language that supports imperative, functional, procedural, and object-oriented programming. It’s versatile, can be used for practically anything, and is a go-to language for many when working in artificial intelligence or machine learning. I use it for a lot of automation, and it’s even the language that some of the testing 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 ensure that they’re in your PATH, but you’ll also need something to actually write code in. You could use a full-fledged IDE (Integrated Development Environment) like PyCharm, or you could lean towards a text editor such as the pre-installed IDLE or Sublime Text 3. There are many options, but this guide should kick-start you on the basics.
Related
How to host a Python Flask project on your NAS with Docker
Most NAS devices support Docker, and here’s how you can make use of it to host your own web project.
How to install Python on Windows and macOS
It depends on the system you use
Installing Python on Windows or Mac is easy. You first need to decide whether you’re installing Python 2.7 or Python 3.x. Python 2.7 is often used for legacy projects, but if you’re writing your own software, then 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 most recent release. At the time of writing, that is 3.11.5.
- Download the binary for your platform.
- Execute the binary.
You don’t need to select any options aside from adding Python to your PATH, as the default installer has everything that you need. Simply clicking Install is all you need to do. On Mac, this will be done by default in the dmg installer.
How to install Python on Linux
Get comfortable with command line
If you use Linux, though, how you install Python will depend on the distribution that you’re using. Debian-based distributions (such as Ubuntu) can use the apt package installer in Terminal by executing the following command:
apt-get install python3
Other distributions may have it already pre-installed, and if not, you’ll need to use the package manager in your distribution. For example, on CentOS, you would execute:
yum install -y python3
How to verify installation
Make sure everything is working
You can verify your install is active by running the “python” command in PowerShell, command prompt, or your Terminal.
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 well, it’s not great for larger files that may be more complicated. Here are some of the IDEs that I’ve used for Python over the years. All of these IDEs are cross-platform, meaning you can run them on Windows, Linux, or macOS.
PyCharm
If you’re familiar with Android Studio or IntelliJ, then you’re 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 purely just for Python, and it packs all the features you’d expect of any modern IDE. That includes built-in version control, syntax highlighting, window splitting, debugging features, and more.
Download PyCharm
Spyder
If you’re a data scientist (or are going to be using Python for data science purposes), then you need to install Spyder. It’s an IDE that features some of the most popular data analysis packages for Python already, including matplotlib, numpy, scipy, and pandas. If you want to get into data analysis, data plotting, and other scientific investigation, then Spyder is 100% what you need to install. Spyder even has Jupyter Notebooks built in, which can be used to explore and plot data really easily.
Download Spyder
Sublime Text 3
Sublime Text 3 is one of my go-to text editors thanks to its simplicity. It’s super versatile, though barebones, and more suited towards smaller projects. If you’re only working with a few hundred lines of code in a program that you’re writing, then Sublime Text 3 is probably the best way to go. I once wrote a web scraper in Python that would read local renting sites and email me and some friends a link to new listings just using Sublime Text 3 and Python. It’s a perfectly capable development environment and one that I think most people should be familiar with.
Download Sublime Text 3
Visual Studio Code (VSCode)
Visual Studio Code (or VSCode) is one of the most customizable development environments out there, with a massive repository of plugins that you can access. It’s not compatible with Python straight away, but you can install a Python plugin from within that will enable syntax highlighting, intelligent code completion, Jupyter Notebooks, debugging, unit testing, and other features. I love Visual Studio Code, and it’s actually the IDE that I use the most when I’m working on something complex.
Download Visual Studio Code
What next
If you want to get started with development, there are loads of tutorials online that will teach you the basics, including Codeacademy and W3Schools. There are even Python interpreters on Android that you can use to write on your phone, and the best way to learn is by doing. If you’re doing anything resource-intensive that may use a lot of machine learning models or artificial intelligence, you might need one of the best laptops to handle it, though.
The best way that I learned was by realizing a problem or other difficulty I had and trying to figure out a way to automate the solution to it. That’s why I had the idea of writing a program that would scrape renting sites for me, and I’m sure there are other reasons you may find that you want to use Python, too.
Related
How I built a Brotato cheat using Python and Cheat Engine
Cheat Engine is a great tool for figuring out how games store their data, and you can combine it with your favorite programming language.