简体   繁体   中英

How do I get python to import pandas?

I installed Python 3.5.1 from www.python.org. Everything works great. Except that you can't install pandas using pip (it needs visualstudio to compile, which I don't have). So I installed Anaconda (www.continuum.io/downloads). Now I can see pandas as part of the list of installed modules, but when I run python programs I still get:

ImportError: No module named 'pandas'

How do I set up my environment to use the modules from Anaconda?

Note: I have Anaconda's home directory and Library/bin on my path, as well as Python's home directory. I do not have PYTHONPATH or PYTHONHOME set, and I know I have the correct privileges to see everything.

I have successfully installed pandas for a Windows 32 bit version Python 3.4 with pre-complied code (no Visual Studio required) using the website:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml

There is link for Python 3.5 pre-complied code at this site as well, but I have not tested it.

Download the code you want to a directory on your machine.

Using your Windows CMD.exe, go to your python directory and enter:

Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win32.whl"

OR

Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win_amd64.whl

Choose the version based on the version of Python you have have, 32 bit or 64 bit.

Good Luck!

Anaconda has included one version of Python with it. You have to change your system environment path with Anaconda's instead of the former one to avoid conflict. Also, if you want to make the whole process easy, it is recommended to use PyCharm, and it will ask you to choose the Python interpreter you want.

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