I was using Pandas version 0.16.1 and it was working fine but I wanted to update Pandas to version 0.16.2 so I uninstalled it and reinstalled it using
pip uninstall pandas
pip install pandas
The installation seemed to work fine. However, when I attempt to import pandas
import pandas
I get the error:
Traceback (most recent call last):
File "path_to_python/python3.4/site-packages/pandas/__init__.py", line 7, in <module>
from pandas import hashtable, tslib, lib
ImportError: path_to_python/python3.4/site-packages/pandas/hashtable.cpython-34m.so: undefined symbol: pyobject_cmp
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "path_to_python/python3.4/site-packages/pandas/__init__.py", line 13, in <module>
"extensions first.".format(module))
ImportError: C extension: path_to_python/python3.4/site-packages/pandas/hashtable.cpython-34m.so:
undefined symbol: pyobject_cmp not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
However:
cd path_to_python/python3.4/site-packages/pandas/
python setup.py build_ext --inplace
doesn't work either as there is no setup.py to be found. The error is:
Fatal Python error: Py_Initialize: can't initialize sys standard streams
AttributeError: 'module' object has no attribute 'OpenWrapper'
Aborted (core dumped)
Any advice or insight into what could be going wrong would be greatly appreciated!
UPDATE:
I tried to install it from source by downloading the package:
python setup.py install
python setup.py build_ext --inplace
This time the second command generated a lot of output and successfully completed. However, I still get the same error when I try to import pandas
如果有人感兴趣,我无法让pip安装熊猫,但我改用miniconda并安装了它,它工作正常。
I was unable to build pandas using clang due to compiler flags. Clang using C99
model by default which leads to improper compilation of inline
code used in pandas.
So in my case CFLAGS=-fgnu89-inline pip install pandas --global-option=build_ext
did the trick.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.