Pip Raspberry Pi
Pip Raspberry Pi
Projects
Python
In this resource you will learn how to use pip on Windows, so that you can
easily install useful Python software.
What is pip?
How to add Python to your path
How to use pip to install Python packages on Windows
Hardware
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 1/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
If you have used Python before, you may have used code similar to this:
Or perhaps this:
import random
In the examples above, you are importing a module in order to use code
written by somebody else. The modules in the examples are called time
and random , and are included by default when you install Python.
However, people have written lots of other Python modules, and you might
want to use some of their functions in your Python programs. For example,
if you want to manipulate images you might want to use PIL , or you could
make games with pygame , or craft GUIs with guizero . However, if you
try to use these modules without installing them, they won’t work:
This is where pip comes in. To be able to use use external Python modules
in your programs, you can use the pip tool to install them on your
computer. (You have probably already seen instructions for installing
Python modules with pip in guides on the Raspberry Pi website and on
other websites.) A Raspberry Pi with the standard version of Raspbian has
pip already installed. However, your Windows computer may not have pip
on it yet. Let’s change that!
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 2/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
Open a command prompt by typing cmd into the search bar in the
Start menu, and then clicking on Command Prompt:
If you are not using your own computer at home (for example, if you
are using a computer on a school network), you may not see Command
Prompt appear in the menu, or you may not be allowed to open it
because you don’t have administrator privileges. In that case, please
speak to your network manager about whether your network allows the
use of the command prompt to install Python software. If you are not
permitted to use the command prompt, pass this guide to your network
manager so they can install Python modules on your behalf.
Type the following command into the command prompt and press Enter
to see if pip is already installed:
pip --version
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 3/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
If pip is installed and working, you will see a version number like this:
If you do, you’re ready to use pip to install any Python module you like
by typing the following into a command prompt (replace name-of-
module with the name of your module):
If you don’t see a version number and instead get an error message,
continue working through this guide.
If you walked outside and found a python on your path, that would be
really bad! However, we’re talking about whether the location of Python is
in the Windows PATH , which is the list of places where Windows
automatically looks for software.
If you saw Python start up, skip to the next section. If you saw an error
message instead, follow the steps below to add Python to your PATH .
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 4/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
A window will open up with some les and folders: this should be where
Python is installed. Right-click on the address bar at the top and select
Copy address as text.
Note: if the address bar contains the words Start menu, then you are
probably looking at a shortcut to Python. Right-click on the le called
Python 3.x (where 3.x is the version number of your Python
installation) and select Open le location until you see a folder
containing a le called python.exe .
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 5/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
In the search box on the top right, type in environment , and in the
search results, click on Edit environment variables for your account:
If your pop-up box looks like the image below, click New and then paste
in the address you just copied. Then click New again, paste in the
address again, and add Scripts\ at the end. Click OK twice to nish
editing your environment variables.
If your pop-up box has only a single line for the variable value, paste in
the address, type a semicolon ( ; ), then paste in the address again and
add Scripts\ at the end. Click OK to nish editing environment
variables.
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 6/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
If the the command prompt window is still open, close it and re-open it.
This will make sure the changes have taken e ect in the command
prompt you are using.
Once again, type in python at the command prompt and press the
Enter key. You should now see Python start successfully. Press Ctrl + c
to exit the Python shell.
Now that you can use Python from the command line, you can use pip! The
following instructions should work for Python version 3.4 and above. If you
are using an older version of Python, you can upgrade Python via the
Python website (https://www.python.org/downloads/).
Now you can install modules using the pip install command. For
example, if you wanted to download and install the guizero module,
you would type this:
If you use online guides, you might often see instructions for installing
Python packages with pip on Linux. For example, you might see this
command to install the Pygame Zero module:
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 7/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
Uninstall a module:
pip list
Have fun using pip to install lots of new packages! Why not try these
resources, which require Python modules to be installed:
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 8/9
11/10/2018 Using pip on Windows | Raspberry Pi Projects
https://projects.raspberrypi.org/en/projects/using-pip-on-windows/print 9/9