简体   繁体   English

无法导入熊猫

[英]Can't Import Pandas

Maybe I wasn't clear before so I am reformatting the whole question. 也许我之前不太清楚,所以我正在重新格式化整个问题。 There is most likely some error with my path variables that I don't know how to fix... 我的路径变量很可能存在一些我不知道如何解决的错误...

I have a script entitled test.py: 我有一个名为test.py的脚本:

import pandas as pd
df = pd.csv_read("nbaData.csv")

When running this script I get this error: 运行此脚本时,出现以下错误:

C:\Users\joeblow\Desktop\repos\BitBucket\basketball>python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import pandas as pd
  File "C:\Python27\lib\site-packages\pandas\__init__.py", line 13, in <module>
    "extensions first.".format(module))
ImportError: C extension: No module named numpy not built. If you want to import
 pandas from the source directory, you may need to run 'python setup.py build_ex
t --inplace' to build the C extensions first.

When typing conda install pandas 键入conda install pandas

C:\Users\joeblow\Desktop\repos\BitBucket\basketball>conda install pandas
Fetching package metadata: C:\Users\joeblow\Anaconda\lib\site-packages\requests\p
ackages\urllib3\util\ssl_.py:90: InsecurePlatformWarning: A true SSLContext obje
ct is not available. This prevents urllib3 from configuring SSL appropriately an
d may cause certain SSL connections to fail. For more information, see https://u
rllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
....
Solving package specifications: .
# All requested packages already installed.
# packages in environment at C:\Users\joeblow\Anaconda:
#
pandas                    0.16.2               np19py27_0

THIS QUESTION CAN BE DELETED BY A MODERATOR. 管理员可以删除此问题。 My solution involved uninstalling and reinstalling python on my computer 我的解决方案涉及在计算机上卸载并重新安装python

It would seem that Conda does not have all of your packages, I'd suggest using Anaconda and follow those instructions it has all the packages, including Pandas no need to install anything else on Windows.. 似乎Conda没有您的所有软件包,我建议您使用Anaconda并按照包含所有软件包的说明进行操作,包括Pandas,无需在Windows上安装其他任何软件。

C:\Users\Tom\Anaconda>python
Python 2.7.6 |Anaconda 1.9.2 (64-bit)| (default, Nov 11 2013, 10:49:15) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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