-
Notifications
You must be signed in to change notification settings - Fork 1.1k
InstallingPackages
From the "Tools" menu select "Manage packages..." and follow the instructions.
- From the "Tools" menu select "Open system shell...". You should get a new terminal window stating the correct name of the pip command (usually
pip
orpip3
). In the following I've assumed the command name ispip
. - Enter
pip install <package name>
(eg.pip install pygame
) and press ENTER. You should see pip downloading and installing the package and printing a success message. - Close the terminal (optional)
- Return to Thonny
- Reset the interpreter by selecting "Stop/Reset" from the "Run menu" (this is only required the first time you do the pip install)
- Start using the package
The Python distribution that comes with Thonny doesn't contain scientific programming libraries (e.g. NumPy and Matplotlib).
Recent versions of most popular scientific Python packages (eg. numpy, pandas and matplotlib) have wheels available for popular platforms so you can most likely install them with pip but in case you have trouble, you could try using Thonny with a separate Python distribution meant for scientific computing (eg. Anaconda, Canopy or Pyzo).
Go to https://www.continuum.io/downloads and download a suitable binary distribution for your platform. Most likely you want the graphical installer and the 64-bit version (you may need a 32-bit version if you have a very old system). Note that Thonny supports only Python 3, so make sure you choose a Python 3 version of Anaconda.
Install it and find out where it puts the Python executable (python.exe in Windows and python3 or python in Linux and Mac). For example in Windows the full path is by default c:\anaconda\python.exe
.
In Thonny, open the "Tools" menu and select "Options...". In the options dialog, open the "Intepreter" tab, click "Select executable" and show the location of Anaconda's Python executable.
After you have done this, the next time you run your program, it will be run through Anaconda's Python and all the libraries installed there will be available.
Thonny's main developers are not native English speakers. Feel free to create an issue if you spot a grammar or style error in the wiki.