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

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?

thanks
Reply
#2
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
Reply
#3
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
C:\>python
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__
'3.0.3'
>>> exit()
C:\>
Quick demo virtual environment as mention bye @gruntfutuk.
# Make environment
E:\div_code
λ python -m venv my_env

# Cd in
E:\div_code
λ cd my_env\

# Activate 
E:\div_code\my_env
λ 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
Home-page: https://openpyxl.readthedocs.io
Author: See AUTHORS
Author-email: [email protected]
License: MIT
Location: e:\div_code\my_env\lib\site-packages
Requires: jdcal, et-xmlfile
Required-by:
It's now a isolated environment,like a new Python version not touching your main installation.
Reply


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

Forum Jump:

User Panel Messages

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