Python For Beginners

How to Install Visual Studio + Python + Anaconda in Windows 10 step by step

Most Python for beginners tutorials go immediately to the programming side of Python, i.e the syntax, functions etc but they rarely mention how to really get started: What to install? From where?

This tutorial assumes that you don’t know anything about Python so I will break everything down step by step. At the end you will have in your computer all the software you need to write and manage Python scripts.

I have found that the best way to learn Python is to get the appropriate tools, in this case we have Visual Studio, the language itself (Python) and a package/environment manager (Anaconda). These 3 make it very easy for you to develop Python applications and put them into production.


Visual Studio

Microsoft really makes it easy these days, you only need to go here and get the Community version. With this version you don’t have to pay anything, no fees, no subscription and it includes all you need to create cool applications (and machine learning algorithms)

But first, what is VS?? Well, it is an IDE which stands for Integrated Development Environment which essentially means it contains a lot of libraries, applications and features to develop cool stuff. There are plenty of IDEs out there if you wish to Google them.

Once you click on Community 2017 you will get a downloader (usually into your downloads folder). Click on it and:

Select the Community Edition Installer

Select Python and Anaconda and if you want to, select a different folder for the installation (I have it on another drive)

While you wait for the installer to be done, you can go ahead and create a Microsoft account (otherwise your “trial expires in 30 days”)

Creating Microsoft Account

Go to this site again and click sign in where you will be able to create an account (No account? Create one!)

I usually don’t check the “Send me stuff” button but up to you.

Once you do this login and activate the benefits for VS Community Edition.


Anaconda

What is Anaconda?? First of all it has the name of this guy (or gal) right here.

Anaconda is an amazing piece of Software that makes it extremely easy to manage the other snake: Python!

By manage I mean:

  1. Create different environments: Maybe for a particular application you need a set of x libraries and for another application you need another set. With Anaconda you can keep those sets (environments) separated from each other and summon them (activate them) when needed.
  2. Installs your favorite packages for you: Let’s be honest here, Python sometimes might feel like Linux (even Ubuntu) in that in order to install a package you need to install a lot of dependencies and pray that everything gets along. Anaconda allows you to install scientific, math and ML packages without the dependency headache.
  3. Anaconda Navigator: This is just awesome, it is a visual dashboard where you can do so many interesting things like install packages for your environments, launch Jupyter notebooks and more.

Installing Anaconda

You already did when you installed Visual Studio!


Doing Python

All right, we now have installed everything we need so let’s get to run Python stuff.

After Visual Studio finished installing you should be able to click launch (or find it in the installed programs) then proceed to sign in with the credentials you created.

After you sign in, VS will make some things ready for you like theme selection (i prefer dark) and Development Settings (General)

Dark theme just looks great!

All right, how do we program in Python now while making use of Anaconda?

Creating an environment

Search and Open the Anaconda Navigator.

Your choice if you want to provide data for making it better. Now, we need to create a Python environment so click on Environments and Create.

Name your environment (mine is honeyBadger) and click Create

By the way, you will notice the “root” environment which is the default installation of Python, I prefer to leave that one alone and create separate more manageable envs.

Once the environment is created, we need to do some extra work in VS to point to this particular environment.

Go to Visual Studio and create a Python project.

If you wish, give it a different more meaningful name.

Now we will have this screen where you can see that there is a default environment of Python

Now go to Tools -> Python -> Python Environments. On the solution explorer on the top right you will see a new window, can’t see it very well so go ahead and do Dock as Tabbed Document.


Now that this window is more visible we can point to our honeyBadger environment, we need to find where in the computer this env was created, by default it is created in here:

C:\Users\UserName\AppData\Local\conda\conda\envs\honeyBadger

So put that in the prefix path and then click on Auto Detect, it should populate the other fields like this:

Finally click Apply and done!

Now the last step is to integrate this env to our project which we do by right clicking on Python Environments and thenĀ Add/Remove Python Environments.

Select honeyBadger and click ok. VS will take a few minutes to read and check all the installed packages.

Once finished, you can just write print(“Hello World!”) and click the green button to run it and you are done!

Congratulations on your first Python Script! Now you can go to the next post to learn about Functions.