Install and import

While typing a symbol, let PyCharm install it and generate the import.

Type the symbol, let your IDE install the package and write the import.

IDEs are great at janitorial work. PyCharm can generate your import for you, even when you haven't installed the package.

In Depth

You're writing code and want to import a package, and want PyCharm to generate the import. But you haven't installed it yet. PyCharm can do both.

Type the name of the package and hit Alt-Enter, then choose Install and Import package. PyCharm will do both: you'll see a notification during the installation, then the import will be generated in the right way, according to your project styles.

Extra credit: if PyCharm sees that this new package isn't recorded in your package's requirements.txt or Pipfile, it will generate a warning which you can correct with -- again -- Alt-Enter.

Full Video