I desire to use the python modul called "pandas" for a little private project.
For this purpose, I installed the modul "pandas" through "pip install pandas" and the other necessary modul openpyxl by "pip install openpyxl". The install part succeeded because when I re-do the install step, the cmd tells me "Requirement already satisfied".
So I wrote this little python here
`
import pandas as pd
excel_file = 'Marci.xlsx'
df = pd.read_excel(excel_file)
`
However, an error is being thrown "ModuleNotFoundError: No module named 'openpyxl'"
I am not sure what I am supposed to do.
Regards, Soprah
- pip install pandas
- pip install openpyxl
CodePudding user response:
I see you are running the program in a venv
environment.
In the venv
, run pip freeze
(or the equivalent on windows, I use macOS and am unaware) in the command line. Then, try running the same command outside of the venv
environment. If you see the packages you are trying to install in the pip freeze
outside of the environment try installing it inside of the environment.
CodePudding user response:
most (OS)s has both Python v2 and Python v3 installed by default on the system, and hence have two pip variants for each Python version. 'pip', which refers to Python v2. and pip3 which refers to Python v3. since most of (OS)s fully support python 3 and (OS)s like Linux has only Python 3 installed by default on the system, but anyway it still requires a separate python-pip installation. try to run (pip3 install openpyxl) you're using python3 you should have the package on pip3, not pip, and every time use shebang at the top of your file, so the system will not get confused if you have more than one python version on your system.