ImportError: No module named pandas. Pandas installed pip

后端 未结 5 2075
星月不相逢
星月不相逢 2021-01-01 17:51

i use mac terminal to check my package:

pip list

i can find all packages include pandas

but

5条回答
  •  感动是毒
    2021-01-01 18:25

    I had Python2 and Python3 installed in different directories but I was facing this error because whenI was using the command pip install pandas it was installing pandas in Python2 directories while I was using Python3

    So I had two diectories with Python2 --> C:\Python27 and Python365 --> C:\Python365.

    To resolve this error:

    Run pip install pandas in cmd. If library pandas is already installed you'll see something like following.

    C:\Users\vichitrak>pip install pandas
    Requirement already satisfied: pandas in c:\python27\lib\site-packages (0.23.4)
    Requirement already satisfied: python-dateutil>=2.5.0 in c:\python27\lib\site-packages (from pandas) (2.7.3)
    Requirement already satisfied: numpy>=1.9.0 in c:\python27\lib\site-packages (from pandas) (1.14.4)
    Requirement already satisfied: pytz>=2011k in c:\python27\lib\site-packages (from pandas) (2018.4)
    Requirement already satisfied: six>=1.5 in c:\python27\lib\site-packages (from python-dateutil>=2.5.0->pandas) (1.11.0)
    

    From the output of above command you can see that pandas is installed in Python2 directory i.e. c:\python27\lib\site-packages (0.23.4)

    Run python command in cmd to check which Python version are you running.

    C:\Users\vichitrak>python
    Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information. 
    

    You can see that I'm using Python3 while pandas is installed in Python2 directory`

    To install the pandas and other libraries in Python3 go to scripts folder in Python3 directory i.e. C:\Python365\Scripts
    Open Command Window and run pip install pandas

    Or you can use the complete path of pip in Python3 directory on cmd to run the intsall command i.e. C:\Users\vichitrak>C:\Python365\Scripts\pip install pandas

提交回复
热议问题