Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

packages are already satisfied but can not import them [duplicate]

I want to use pandas on jupyter-notebook. it is using python3. when I use

import pandas as pd

it says:

ModuleNotFoundError: No module named 'pandas'

but when I use:

pip install pandas

it returns:

Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages (0.24.2)

how can I import packages like this. it is set to use python3 but for pip command it see python2.7

like image 712
MHB Avatar asked Jan 26 '26 08:01

MHB


1 Answers

Obviously, you are running several python versions in your PC. The environment value pip indicate to Python 2.7. However, you want use pandas module in your Python 3.

One solution:

Find the pip.py of your python 3 local address. Then add this address of pip.py to your PC environment as environment name with pip3.

The rest operation is the same: in CMD: $ pip3 install pandas

like image 58
Zhengfang Xin Avatar answered Jan 27 '26 23:01

Zhengfang Xin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!