简体   繁体   English

将源安装的熊猫链接到自制的python

[英]Linking source installed pandas to homebrew'd python

I am attempting to install the python package pandas . 我正在尝试安装python软件包pandas

All my existing python gear has been installed using home-brew / easy_install / pip, however pip and easy_install both fail on pandas -- claiming that i do not have numpy > 1.6 (though when in python numpy.__version__ returns 1.6.2). 我所有现有的python齿轮都已使用home-brew / easy_install / pip安装,但是pip和easy_install都在pandas上都失败了—声称我没有numpy> 1.6(尽管在python numpy.__version__返回1.6.2)。

Despite this pip install numpy --upgrade reports that I am up-to-date. 尽管pip install numpy --upgradepip install numpy --upgrade报告我是最新的。

To hack around this, I git-cloned the source code down, and ran python setup.py install in my /Library/Python/... directory. 为了解决这个问题,我将源代码git-cloned下,并在/Library/Python/...目录中运行python setup.py install It seemed to build okay, however when i import pandas, i get an error and i'm not sure what to do about it. 看起来似乎还可以,但是当我导入熊猫时,出现错误,并且不确定如何处理。

Can anyone help me link the compiled library to my existing install? 谁能帮助我将编译后的库链接到现有安装?

The error follows: 错误如下:

dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so, 2): Symbol not found: _floatify
  Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/__init__.py", line 10, in <module>
import pandas.lib as lib
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so, 2): Symbol not found: _floatify
Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so
Expected in: flat namespace
in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.9.1.dev_5a152bd-py2.7-macosx-10.7-x86_64.egg/pandas/lib.so

This was discussed and resolved on GitHub: https://github.com/pydata/pandas/issues/2188 . 在GitHub上对此进行了讨论和解决: https : //github.com/pydata/pandas/issues/2188 The issue had to due with Clang's C99 behavior wrt inline C functions. 该问题必须归因于Clang的C99行为以及内联C函数。

Fixed the root problem ( pip install pandas failing) on my MBP, and then tested it on another box -- the problem seems to be a conflict between the old version of numpy that comes with the mac install, and the newer one subsequently installed using pip . 修复了我的MBP的根本问题( pip install pandas失败),然后在另一个机器上对其进行了测试-问题似乎是mac install随附的旧版本numpy与随后使用进行安装的较新版本之间的冲突pip Pandas sees the old numpy, and fails. 熊猫看到了旧的麻木,但失败了。

To fix this, cd to the location of the default packages. 要解决此问题,请使用cd到默认软件包的位置。 Yours is probably the same as mine: 您的可能与我的相同:

$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/ 
$ sudo rm -r numpy

$ sudo pip install pandas

With that out of the way, sudo pip install pandas worked for me on both boxes. 有了这种方式, sudo pip install pandas在两个盒子上都对我有用。

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

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