I am struggling with this issue.
I have a small python project that is running inside a virtual environment. I installed this module as pip install openpyxl
(I also tried pip3 install openpyxl
or python3 -m pip install openpyxl
with the same result).
When I run my script, I get this error:
ModuleNotFoundError: No module named 'openpyxl'
In the traceback, I see references to my version of python (3.11.8):
...
File "/opt/homebrew/Cellar/[email protected]/3.11.8/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
When I do pip list
for my venv
, I get
Package Version
---------- -------
et-xmlfile 1.1.0
openpyxl 3.1.2
pip 24.0
setuptools 69.5.1
wheel 0.43.0
When I do pip list
outside of my venv
, there’s no openpyxl
.
When I do which python3
, I get
/Users/adam/pythondev/myproj/.venv/bin/python
Based on googling, I apparently installed openpyxl
to a wrong version of python? However, how do I fix this and install to my version of python? (python3 --version
=> Python 3.11.8
)