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
pip install PyPDF2
pip install python-docx
(install python-docx
, not docx
)
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