我在 linux 命令提示符下使用 pip 安装了 pandasql,并启动了 ipython notebook:
felix@xanadu ~ $ sudo pip install pandasql
[sudo] password for felix:
Downloading/unpacking pandasql
Downloading pandasql-0.6.2.tar.gz
Running setup.py (path:/tmp/pip_build_root/pandasql/setup.py) egg_info for package pandasql
Installing collected packages: pandasql
Running setup.py install for pandasql
Successfully installed pandasql
Cleaning up...
felix@xanadu ~ $ ipython notebook
然后尝试在 ipython notebook 中导入 pandas 和它:
import pandas
import pandasql
..它不高兴,环顾四周,但似乎没有任何地方有答案。这是它给出的错误消息:
--------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-c9fa37159ca4> in <module>()
1 import pandas
----> 2 import pandasql
/usr/local/lib/python2.7/dist-packages/pandasql/__init__.py in <module>()
----> 1 from .sqldf import sqldf
2 import os
3 import pandas as pd
4
5
/usr/local/lib/python2.7/dist-packages/pandasql/sqldf.py in <module>()
2 import pandas as pd
3 import numpy as np
----> 4 from pandas.io.sql import to_sql, read_sql
5 import re
6 import os
ImportError: cannot import name to_sql
有没有人有任何想法?干杯