我在macOS10.13.6上,通过brew安装了python3,通过pip安装了pandas。
我无法导入
from pandas.io.json import json_normalize
在python3 shell或VS Code和Sublime中...我收到此错误:
> Traceback (most recent call last):
File "pandas.py", line 2, in <module>
from pandas.io.json import json_normalize
File "/Users/flw/dev/csv_transform/pandas.py", line 2, in <module>
from pandas.io.json import json_normalize
ModuleNotFoundError: No module named 'pandas.io'; 'pandas' is not a package
其中python3表示:
/usr/local/bin/python3
pip3安装熊猫:
Requirement already satisfied: pandas in /usr/local/lib/python3.7/site-packages (0.24.1)
Requirement already satisfied: numpy>=1.12.0 in /usr/local/lib/python3.7/site-packages (from pandas) (1.16.1)
Requirement already satisfied: python-dateutil>=2.5.0 in /usr/local/lib/python3.7/site-packages (from pandas) (2.8.0)
Requirement already satisfied: pytz>=2011k in /usr/local/lib/python3.7/site-packages (from pandas) (2018.9)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)
打印(系统路径):
['', '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Users/flw/Library/Python/3.7/lib/python/site-packages', '/usr/local/lib/python3.7/site-packages']
答案 0 :(得分:0)
此解决方案成功了
通过
发现了错误SELECT * FROM dbo.MyTable WHERE Location.STDistance(@CurrentPlace) <= 5000;
此命令抛出错误
python3 -c "import pandas as pd; print(pd.__version__)
然后我用
修复了它ImportError: bad magic number in 'pandas': b'\x03\xf3\r\n'
清理pyc文件...