在 Mac OS X 10.6.3 中安装 h5py

发布于 2024-09-02 01:41:37 字数 1793 浏览 5 评论 0原文

我正在尝试在 Mac OS X 10.6.3 中安装 h5py。

首先我安装了HDF5 1.8,它使用了以下命令:

./configure \
--prefix=/Library/Frameworks/Python.framework/Versions/Current \
--enable-shared \
--enable-production \
--enable-threadsafe \
CPPFLAGS=-I/Library/Frameworks/Python.framework/Versions/Current/include \
LDFLAGS=-L/Library/Frameworks/Python.framework/Versions/Current/lib

make
make check
sudo make install

然后安装h5py:

/Library/Frameworks/Python.framework/Versions/Current/bin/python \
setup.py \
build \
--api=18 \
--hdf5=/Library/Frameworks/Python.framework/Versions/Current

然后我得到了错误:

******************************************
Configure: Autodetecting HDF5 settings...
    Custom HDF5 dir:       /Library/Frameworks/Python.framework/Versions/Current
    Custom API level:      (1, 8)
ld: warning: in detect/vers.o, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /Library/Frameworks/Python.framework/Versions/Current/lib/libhdf5.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

Failed to compile HDF5 test program.  Please check to make sure:

* You have a C compiler installed
* A development version of Python is installed (including header files)
* A development version of HDF5 is installed (including header files)
* If HDF5 is not in a default location, supply the argument --hdf5=<path>
******************************************
error: command 'cc' failed with exit status 1

我刚刚更新了我的Xcode,我不知道这是否是因为我的gcc的默认设置。如果是这样,我怎样才能摆脱这个错误?

谢谢。

I'm trying to install h5py in Mac OS X 10.6.3.

First I installed HDF5 1.8, which used the following commands:

./configure \
--prefix=/Library/Frameworks/Python.framework/Versions/Current \
--enable-shared \
--enable-production \
--enable-threadsafe \
CPPFLAGS=-I/Library/Frameworks/Python.framework/Versions/Current/include \
LDFLAGS=-L/Library/Frameworks/Python.framework/Versions/Current/lib

make
make check
sudo make install

Then install h5py:

/Library/Frameworks/Python.framework/Versions/Current/bin/python \
setup.py \
build \
--api=18 \
--hdf5=/Library/Frameworks/Python.framework/Versions/Current

Then I got the errors:

******************************************
Configure: Autodetecting HDF5 settings...
    Custom HDF5 dir:       /Library/Frameworks/Python.framework/Versions/Current
    Custom API level:      (1, 8)
ld: warning: in detect/vers.o, file was built for unsupported file format which is not the architecture being linked (i386)

ld: warning: in /Library/Frameworks/Python.framework/Versions/Current/lib/libhdf5.dylib, file was built for unsupported file format which is not the architecture being linked (i386)

Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o

ld: symbol(s) not found

collect2: ld returned 1 exit status

Failed to compile HDF5 test program.  Please check to make sure:

* You have a C compiler installed
* A development version of Python is installed (including header files)
* A development version of HDF5 is installed (including header files)
* If HDF5 is not in a default location, supply the argument --hdf5=<path>
******************************************
error: command 'cc' failed with exit status 1

I just updated my Xcode, I don't know whether this is because my gcc's default setting. If so, how can I get rid of this error?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

¢好甜 2024-09-09 01:41:37

我刚刚在尝试使用 Intel C/C++ 编译器在 Mac OS X 上构建 Python 扩展模块时遇到了类似的错误。要修复“未定义的符号:_main”错误,我必须将以下内容添加到链接器命令中: -bundle -undefinedynamic_lookup

您可以执行“man ld”来找出特定链接器命令的作用,但基本上您是在告诉链接器不必担心未定义的符号,并在加载库时动态查找它们。

I just came across a similar error while trying to build a Python extension module on Mac OS X with the Intel C/C++ compiler. To fix the "undefined symbols: _main" error I had to add the following to the linker command: -bundle -undefined dynamic_lookup

You can do a 'man ld' to find out what the specific linker commands do, but basically you are telling the linker not to worry about undefined symbols and to look them up dynamically when the library gets loaded.

悟红尘 2024-09-09 01:41:37

如果您使用 macports 尝试: py26-h5py

If you use macports try: py26-h5py

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文