Appendix A
Installing Python

To follow along with the program examples in the first nine hours of this tutorial, you need to have Python on your computer. There are several options for using Python, regardless of whether you use Windows, macOS, or Linux. You can either enter your code in a text editor and run the programs at the command line or you can install an integrated development environment (IDE) for the editing and running of your code. Ultimately, it is your preference, but there are advantages to using an IDE in terms of better debugging support: If you make an error in your code, you will often get better clues as to what went wrong with an IDE.

If you choose an IDE, you can either select a Python-specific IDE, like Jupyter Notebook or PyCharm, or an IDE that you can use for multiple languages, like Visual Studio or Eclipse. (I do not recommend the latter for beginners as you need a plugin named PyDev for Eclipse to be an effective Python development environment. It might be your environment of choice in the long run, but for a beginner, it probably makes more sense to start simple.)

Downloading Python from the Python Software Foundation

Note

Follow the directions in this section if you don’t want to install an IDE. If you’d like to use an IDE like the one in the examples in the first section of the book, jump to the “Installing Anaconda” section that follows.

To get started with Python, navigate to www.python.org. Clicking on the Download option on the menu below the Python logo will take you to a page with options for downloading Python for Windows, macOS, or Linux (see Figure A.1). The default is the latest version of Python 3 (3.7.3 for this installation, but 3.7.4 as of this writing), but you can also scroll down to download a version of Python 2 (most likely 2.7.16).

images

FIGURE A.1 Downloading Python from python.org. (©2001-2019 Python Software Foundation)

Clicking the Windows button to install Python brings up the dialog box shown in Figure A.2; I’m sure you’ve seen similar ones when you’ve installed other software. Click Run.

images

FIGURE A.2 Your computer prompts you to ensure that you want to make the requested changes to your computer.

When the setup file has completed downloading, you see the installation dialog box shown in Figure A.3. You can choose to customize your installation, but you’re better off with the default installation.

images

FIGURE A.3 The default installation of Python should give you everything you need.

When the download is complete, you can then start running Python programs that you create at the command prompt. Again, the recommendation is to use an IDE, such as the one covered in the next section.

Installing Anaconda

Anaconda not only gives you access to an IDE but also simplifies the installation and use of Python libraries. To install Anaconda, go to the website https://www.anaconda.com/distribution/ (see Figure A.4).

images

FIGURE A.4 The Anaconda distribution home page. (www.anaconda.com/distribution/ © 2019 Anaconda, Inc.)

Click the Download button in the upper section of the page. You can then click whether you want to proceed with a Windows, macOS, or Linux installer (see Figure A.5). For each operating system, you can choose whether to install Python 2 or 3.

images

FIGURE A.5 With each operating system, you have numerous choices.

Once you’ve made your operating system and Python version choices, you can proceed with the installation (see Figure A.6). After you click Next to proceed, you have the opportunity to make advanced changes to your installation. At this point, I recommend going with the default options (see Figure A.7).

images

FIGURE A.6 Beginning the setup process.

images

FIGURE A.7 Keep the first option unclicked and the second one clicked.

Click Install to complete the installation. Then you can launch the Anaconda Navigator (see Figure A.8). There are several options for you here, and I recommend doing some exploring on your own if you are so inclined. For this book, the second option on the first line, Jupyter Notebook, is where you will be doing the bulk of you coding. Launch it.

images

FIGURE A.8 The Anaconda dashboard.

Jupyter Notebook launches within your web browser (see Figure A.9).

images

FIGURE A.9 Once Jupyter Notebook launches, you can either create a new notebook or open an existing one (if you have one). (Credit: © 2019 Project Jupyter)

On the right side, click the New button to launch a new notebook. In the pop-up menu that appears, highlight Python 3. A new tab opens in your browser with your new notebook, ready for your coding adventures (see Figure A.10). Start following along with the book’s examples!

images

FIGURE A.10 Who’s ready to code?

Other Python Environments

If you want to use a different Python IDE, you can go to PyCharm’s home page (https://www.jetbrains.com/pycharm/) or the Visual Studio installation page (https://visualstudio.microsoft.com/) and follow the download directions. Ultimately the code will run the same, regardless of the environment; it’s up to you to pick the IDE you like the best.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset