How To Install Python On Your Computer — The Easy Way
I use the programming language Python almost every day. I use it for work, I use for munging data on my personal projects, and even use it for SEO purposes. Python is such an amazing language and you can use it to do just about anything.
Yet, there are many people who want to give it a try and have a hard time installing it, let alone writing the first “Hello, World” script.
This is a simple installation tutorial and guide to get Python on your machine.
Get the Anaconda distribution
The simplest way to get Python on your Mac, Linux box, or Windows machine is to use the Anaconda version.
Anaconda is just a distribution of Python with many scientific computational packages built in.
Since I work in the machine learning/data science space, Anaconda is my go-to source for all things related.
I like it a lot because of its package manager. The Anaconda package makes it easy to upgrade and download required packages. It does all the version checking and gets you the right version for your version of Python.
For example, installing FB Prophet is as simple as doing:
conda install -c conda-forge fbprophet
I don’t want to be lame and point you to the Anaconda documentation, but I will. Why? Because you might get stuck and here are some more detailed installation instructions.
Honestly, I’ve never had to read these them. I’ve installed Anaconda on my old Windows machine and twice on two different Macs. It’s pretty simple.
Let’s get started. Go to the Anaconda downloads page and grab the right installer.
Then download and install. Follow the instructions on the screen. It will install the latest version of Python, which at the time of my last installation was version 3.9.
Don’t get any version 2.X, that version because it’s old and no longer being developed. Stick with version 3.7 and greater — I use version 3.7 a lot.
Some gotchas — read first after download
I had no idea what I was doing when I first started venturing into Python. I admit, I was a noob and made so many messy mistakes.
What do I mean by messy mistakes? I had Python libraries and modules all over the place. Sometimes I would install a new library or package and break something else. Other times I would uninstall a package and break something else.
This drove me up the wall until I learned about virtual environments.
Virtual environments are handy for keeping your projects and tinkering organized. You can create medium-forecasting
virtual environment for your FB Prophet project and create a different virtual environment for another project.
Anaconda makes this simple and easy to use with the added benefit of setting up the version of Python you want to use.
Create your first environment
Creating your first virtual environment with Anaconda is as simple as typing this into your terminal or command prompt:
conda create --name my-new-env-name
If you type that above you will also install the default Python version.
If you don’t want to default Python version you can just add another argument like python==3.7
conda create --name my-new-env-name python==3.7
Then Anaconda will create the virtual environment and install the base Python packages with the correct versions.
Once you’re done you can activate the new environment by typing:
conda activate my-new-env-name
To deactivate the environment just type:
conda deactivate
Start coding
That’s it, then start coding! I would recommend checking out my Forecasting Medium Follower Growth with FB Prophet article. I provide the sample code and you can always leave me a comment if you get stuck.
If you’re more advanced and want to explore Python and build your own standalone apps, I suggest checking out H2O.ai’s Wave and Nitro projects. Both are Python-based without the need for learning javascript or CSS, it’s an app framework that comes with batteries.
Member discussion