Third-Party Python Libraries

There are lots of third party libraries you can download and install. For those interested in image manipulation with Python, there's a popular third-party library called Pillow that you can import and use. Let's import this.

From the menus at the top of PyCharm, click File > Settings (Default Settings on a Mac). From the Settings dialogue box, click on the Project Interpreter item on the left-hand side:

The Project Interpreter section of PyCharm's Settings dialog box

Click the green plus symbol in the top right, in Windows. (Mac users will see the plus symbol button in the bottom left. Linux users: if your Project Interpreter dropdown says No Interpreter, select Python 3 from the list.)

The Add Package button of the PyCharm settings dialog box

For all users, if the dropdown is blank, click the gear icon to the right of the dropdown. From the menu that appears, select add (screenshot from a Mac):

Mac screenshot of the Project Interpreter

From the dialog box that appears, select Virtual Environment on the left and make sure New Environment is selected:

The New Environment section of the Python Interpreter

You should be sent back to the Default Preferences box where pip and setuptools are on the list. Click the plus symbol bottom left (top right for Linux and Windows users), highlighted in red below:

The Add Package button on PyCharm for the Mac

All users will then see a new dialog box appear. This one:

The Available Python Packages screen in PyCharm

(NOTE: If this box is blank with the error, "error loading package list: pypi.python.org", make sure you have an internet connection. Click Manage Repositores. From the dialog box that appears, select https://pypi.python.org/simple. Click OK. Click the reload button middle top.)

Type in pillow in the search area at top. Press enter to see the search results. Make sure that pillow is highlighted and then click Install Package at the bottom.

Importing the Python Pillow package in PyCharm

When Pillow has been downloaded and installed, you should a message at the bottom of the dialog box:

A successful import of the Pillow package

Close down this dialog box by clicking on the X in the top right (on Windows). You will be returned to the Settings dialog box:

The settings screen with the Pillow Python package installed

When you see the message at the bottom telling you that Pillow has installed successfully then you can click the OK button on the Settings dialog box.

Let's now put Pillow to use. We'll do that in the next lesson.

Using Pillow >