Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
installing openpyxl

Total python newbie here; nearly 20 years since I've done any programming...

I've managed to install python on my pc and run 'Hello, World!'... so far so good...

but now I need to install the openpyxl library and am encountering problems...

where should this be within the python folder/subfolders once installed?

You have a choice of any package being installed in the default directory, or creating a Python virtual environment using the venv command. The latter option is generally preferred to avoid polluting your base environment with packages that are specific to particular projects (and different projects are likely to need different packages, some of which might conflict with each other).

So on Windows, we usually start Python using the py command on the command or powershell line, and you'd invoke a command like venv or pip using the -m option.

Packages will typically install in <virtualenv_name>/lib/<python_ver>/site-packages when you have a virtual environment.

You can check where pip has installed packages to using:pip list -v or py -m pip list -v
I am trying to help you, really, even if it doesn't always seem that way
Take a look at Python 3.6/3.7 and pip installation under Windows
Just the same for 3.8 if you use that,so all in done bye pip.
# Install
C:\>pip install openpyxl
Collecting openpyxl .....
Successfully built openpyxl
Installing collected packages: openpyxl
Successfully installed openpyxl-3.0.3
WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

# Upgrade pip
C:\>python -m pip install --upgrade pip
Collecting pip ..... 
      Successfully uninstalled pip-19.3.1
Successfully installed pip-20.0.2

# Test pip,see that's it's 20.0.2
C:\>pip -V
pip 20.0.2 from c:\python37\lib\site-packages\pip (python 3.7)

# Test that openpyxl work
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl
>>> openpyxl.__version__
>>> exit()
Quick demo virtual environment as mention bye @gruntfutuk.
# Make environment
λ python -m venv my_env

# Cd in
λ cd my_env\

# Activate 
λ E:\div_code\my_env\Scripts\activate

# Install
(my_env) E:\div_code\my_env
λ pip install openpyxl
Collecting openpyxl .....
Successfully installed et-xmlfile-1.0.1 jdcal-1.4.1 openpyxl-3.0.3

# Show
(my_env) E:\div_code\my_env
λ pip show openpyxl
Name: openpyxl
Version: 3.0.3
Summary: A Python library to read/write Excel 2010 xlsx/xlsm files
Author: See AUTHORS
Author-email: [email protected]
License: MIT
Location: e:\div_code\my_env\lib\site-packages
Requires: jdcal, et-xmlfile
It's now a isolated environment,like a new Python version not touching your main installation.

Possibly Related Threads…
Thread Author Replies Views Last Post
  installing OpenPyXl kwfreverie 11 32,704 Jun-24-2018, 04:30 PM
Last Post: Alfonso

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020