简体   繁体   中英

python newbie - how to import library

I installed the 'pandas' module and now I need to run it at my command line, but it is not available. How to make it available?

In [1]: import pandas as pd
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-af55e7023913> in <module>()
----> 1 import pandas as pd

ImportError: No module named 'pandas'

In [2]: 

Your module can't be found in the current directory, in pythons site-packages folder or in any path defined in the $PYTHON_PATH environment variable.

If you installed pandas via pip install pandas and encounter an ImportError , you most likely have a problem due to multiple python distributions installed on your system.

Look carefully at the output of pip install pandas and examine the folders in its output. Find out which executable you are running when calling python via which python and look at the version numbers.

This is a very common problem btw. so prepare for a close of this question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM