How do I get python to import pandas?

风流意气都作罢 提交于 2019-12-12 00:56:37

问题


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.


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/37557174/how-do-i-get-python-to-import-pandas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!