PAWS/Python with Pip

From Wikitech

PAWS works great with default Python out-of-the-box, but what if you need to import packages from PyPi?

At the start of your file, add code like:

import sys
!{sys.executable} -m pip install [PACKAGE]

Replace "[PACKAGE]" with the name of the package you want to import. For example, to use mwclient, a lightweight wrapper for the MediaWiki API:

import sys
!{sys.executable} -m pip install mwclient

The next time you run this cell of the notebook, the specified package will be automatically downloaded and installed. On subsequent runs, Pip will detect if a package is already up-to-date and installed, and skip downloading.