简体   繁体   English

在python-3.4 unix环境中导入熊猫时出错-未定义符号:pyobject_cmp

[英]error importing Pandas in python-3.4 unix environment - undefined symbol: pyobject_cmp

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 我使用的是Pandas版本0.16.1,并且工作正常,但是我想将Pandas更新到版本0.16.2,所以我将其卸载并使用重新安装

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. 也不起作用,因为找不到setup.py。 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构建熊猫。 Clang using C99 model by default which leads to improper compilation of inline code used in pandas. 默认情况下,使用C99模型的Clang会导致对熊猫中使用的inline代码进行不正确的编译。

So in my case CFLAGS=-fgnu89-inline pip install pandas --global-option=build_ext did the trick. 因此,在我的情况下, CFLAGS=-fgnu89-inline pip install pandas --global-option=build_ext了目的。

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

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