如何为python3导入熊猫?

时间:2018-07-08 11:55:49

标签: python pandas python-3.5

我有一个使用pandas库的python脚本。但是当我尝试使用以下方法安装熊猫时:

pip install pandas

它说:

Installing collected packages: pytz, six, python-dateutil, numpy, pandas
Successfully installed numpy-1.14.5 pandas-0.23.3 python-dateutil-2.7.3 pytz-2018.5 six-1.11.0
You are using pip version 8.1.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command

当我尝试再次运行脚本时,它再次告知没有名为pandas的模块。

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    import pandas as pd
ImportError: No module named 'pandas'

使用建议后,我再次尝试了pip install pandas,但出现错误

Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main

1 个答案:

答案 0 :(得分:0)

我建议一种解决方法,当有人指出您的dependency hell的最终解决方案:使用虚拟环境。

使用miniconda download your package,将其安装并:

conda create -n py37 anaconda python=3.7
source activate py37
pip install pandas