Support the Author: Buy the book on Amazon or
the book/ebook bundle directly from No Starch Press.
Read the author's other free Python books:
POST-PUBLICATION ADDITION: You can install all of the needed modules (with the versions used in this book) by installing theautomateboringstuff1stedition
module with Pip. Runpip install --user automateboringstuff1stedition
from the Command Prompt or Terminal window.
Appendix A. Installing Third-Party Modules
Beyond the standard library of modules packaged with Python, other developers have written their own modules to extend Python’s capabilities even further. The primary way to install third-party modules is to use Python’s pip tool. This tool securely downloads and installs Python modules onto your computer from https://pypi.python.org/, the website of the Python Software Foundation. PyPI, or the Python Package Index, is a sort of free app store for Python modules.
The executable file for the pip tool is called pip on Windows and pip3 on OS X and Linux. On Windows, you can find pip at C:\Python34\Scripts\pip.exe. On OS X, it is in /Library/Frameworks/Python.framework/Versions/3.4/bin/pip3. On Linux, it is in /usr/bin/pip3.
While pip comes automatically installed with Python 3.4 on Windows and OS X, you must install it separately on Linux. To install pip3 on Ubuntu or Debian Linux, open a new Terminal window and enter sudo apt-get install python3-pip
. To install pip3 on Fedora Linux, enter sudo yum install python3-pip
into a Terminal window. You will need to enter the administrator password for your computer in order to install this software.
The pip tool is meant to be run from the command line: You pass it the command install
followed by the name of the module you want to install. For example, on Windows you would enter pip install
ModuleName
, where ModuleName
is the name of the module. On OS X and Linux, you’ll have to run pip3 with the sudo
prefix to grant administrative privileges to install the module. You would need to type sudo pip3 install
ModuleName
.
If you already have the module installed but would like to upgrade it to the latest version available on PyPI, run pip install –U
ModuleName
(or pip3 install –U
ModuleName
on OS X and Linux).
After installing the module, you can test that it installed successfully by running import
ModuleName
in the interactive shell. If no error messages are displayed, you can assume the module was installed successfully.
You can install all of the modules covered in this book by running the commands listed next. (Remember to replace pip
with pip3
if you’re on OS X or Linux.)
-
pip install send2trash
-
pip install requests
-
pip install beautifulsoup4
-
pip install selenium
-
pip install openpyxl==2.1.4
-
pip install PyPDF2
-
pip install python-docx
(installpython-docx
, notdocx
) -
pip install imapclient
-
pip install pyzmail
-
pip install twilio
-
pip install pillow
-
pip install pyobjc-core
(on OS X only) -
pip install pyobjc
(on OS X only) -
pip install python3-xlib
(on Linux only) -
pip install pyautogui