There is a number of ways that we can do this. The simplest one is having the python intepreter coupled with a text editor. This can be a bit tricky for people using the Windows operating system so we will use a neat IDE called PyCharm. At the end you can find some excellent resources to get you started.
If you are using a Mac simply head over to the Python website and download the most recent package. Then double-click on the downloaded file to run the Python 3 installer.
If you are using Windows, download the suitable installer from the
Python website . Double-click on the installer and
on the first screen, check the Add Python 3.x to PATH
option and install. This will let you
use python in your terminal. Then click the Disable path length limit
option to will allow Python to use long path names. If after the installation you type:
$ python
in the
terminal and still get an error then you will have to configure this manually. There are good answers
here (using PowerShell), at
Superuser
(be careful no to copy-paste mindlessly what you find on the Internet), and
docs.
Mac users should be able to access interactive mode by just typing:
$ python3
and you should see something like:
$ python3
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>>
Alternatively you can check which version of python you have installed by:
$ python3 -V
which should return something like the following:
$ python3 -V
Python 3.7.0
On Windows you can type:
C:\> python -V
which should give you the version of python
that you are using.
If you see something like:
'python' is not recognized as an internal or external command, operable program or batch file.then you need to follow the instructions in the above section to set up your environment properly.
There is a number of good editors that you can use if you don't want to use PyCharm:
As far as PyCharm goes, you can download the free Community version from the JetBrains website. It is fine if you want to use any other IDE but this is the one that we'll be mainly using for demonstrating stuff.You can find help installing PyCharm here.
You may use Jupyter if you are comfortable with it but it will probably be a bit of a hassle later on. I will try and find some good resources for using Jupyter with SQL and I will post them here.
There are hundreds of books/videos/websites that you can find if you search for "Python for Beginners". Below you can find some of my favorites:
Important: Be sure that you have configured python properly and that you are able to run just the simplest scripts before the next tutorial. We can't afford to lose time trying to set up machines again.