Once a virtual environment is created, one can install packages using pip integration. Note that it is also possible to install packages for a standard Python interpreter, provided that pip itself is installed for this interpreter.
PyCharm smartly tracks the status of packages and recognizes outdated versions by showing the number of the currently installed package version (column Version), and the latest available version (column Latest). When a newer version of a package is detected, PyCharm marks it with the arrow sign .
In this section:
- In the Python Interpreters page of the Settings dialog, select the desired Python interpreter or virtual environment.
The Packages tab shows pip and distribute installers.
If no Python package management tools are detected, PyCharm reports about it, and suggests to install setuptools/distribute manually, or create a virtual environment. If there are some previously installed packages, they are shown as well.
- Click Install.
- In the Available Packages dialog box that opens, select the desired package from the list.
If necessary, use the Search field, where you can enter any string. So doing, the list of packages shrinks to show the matching packages only.
- If required, select the following check boxes:
- Specify version: if this check box is selected, you can select the desired version from the drop-down list of available versions. By default, the latest version is taken.
- Options: If this check box is selected, you can type the options in the text field.
- Install to user's site packages directory <path>: if this check box is left cleared (by default), then the packages will be installed to the current virtual environment.
- Click Install Package.
PyCharm provides a quick fix that automatically installs the package you’re trying to import: if, after the keyword import, you type a name of a package that is not currently available on your machine, a quick fix suggests you to either ignore the unresolved reference, or download and install the missing package:
- In the Packages tab of the Python Interpreters page, select packages to be deleted.
- Click Uninstall. The selected packages are removed from disk.
- In the Packages tab of the Python Interpreters page, select packages to be upgraded.
- Click Upgrade. The selected packages are upgraded to the latest version.