Hal Pointon
Hal Pointon

Reputation: 11

How to download extra python modules

I'm trying to use python to modify an excel file. I understand the code necessary to do it, my problem is that my python program, from here, won't let me import the right modules (eg. openpyxl). It just throws up a module not found error. What do I have to do/download to allow it to find the modules. Thanks!

Upvotes: 1

Views: 470

Answers (3)

Nathan Krowitz
Nathan Krowitz

Reputation: 43

I think both of the prior two answers should cover what you're trying to do. The only thing I'd like to add is that if you're on a windows machine, and pip is not in the path, you may need to try typing into a command prompt:

python -m pip install openpyxl

Upvotes: 1

taehoonTomKim
taehoonTomKim

Reputation: 11

  1. First, you have to install pip which is a package manager for Python packages/modules.

    1-1. How to install pip on Windows

    1-2. How to install pip on MacOS

2. Open Command Prompt(Windows)/terminal(MacOS)

  1. Run command:

    pip install openpyxl

  2. If you need to install any other extra modules repeat 3

    pip install 'module_name'

Upvotes: 1

gmdev
gmdev

Reputation: 3155

  1. Open terminal if on MacOS or Command Prompt if on Windows

  2. Run command (replace package_name with the name of the module you want to install:

pip install package_name

This method holds true for most of the python libraries that are available. The command installs the latest version of the module that you specify along with its dependencies from the Python Package Index

The Python Package Index (PyPI) is a repository of software for the Python programming language.

From: pypi.org

Upvotes: 1

Related Questions