1

我在安装 MlPy 时遇到以下问题:

sudo python setup.py install

running install
running build
running build_py
running build_ext
building 'mlpy.gsl' extension
llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mlpy/gsl/gsl.c -o build/temp.macosx-10.7-intel-2.7/mlpy/gsl/gsl.o
mlpy/gsl/gsl.c:223:24: error: gsl/gsl_sf.h: No such file or directory
mlpy/gsl/gsl.c:224:39: error: gsl/gsl_statistics_double.h: No such file or directory
In file included from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:1722,
                 from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/arrayobject.h:15,
                 from mlpy/gsl/gsl.c:227:
/Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_sf_gamma’:
mlpy/gsl/gsl.c:835: warning: implicit declaration of function ‘gsl_sf_gamma’
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_1sf_fact’:
mlpy/gsl/gsl.c:887: warning: implicit declaration of function ‘gsl_sf_fact’
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_2stats_quantile_from_sorted_data’:
mlpy/gsl/gsl.c:1123: warning: implicit declaration of function ‘gsl_stats_quantile_from_sorted_data’
mlpy/gsl/gsl.c:223:24: error: gsl/gsl_sf.h: No such file or directory
mlpy/gsl/gsl.c:224:39: error: gsl/gsl_statistics_double.h: No such file or directory
In file included from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/ndarraytypes.h:1722,
                 from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/ndarrayobject.h:17,
                 from /Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/arrayobject.h:15,
                 from mlpy/gsl/gsl.c:227:
/Library/Python/2.7/site-packages/numpy-1.8.0.dev_f2f0ac0_20120725-py2.7-macosx-10.8-x86_64.egg/numpy/core/include/numpy/npy_deprecated_api.h:11:2: warning: #warning "Using deprecated NumPy API, disable it by #defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION"
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_sf_gamma’:
mlpy/gsl/gsl.c:835: warning: implicit declaration of function ‘gsl_sf_gamma’
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_1sf_fact’:
mlpy/gsl/gsl.c:887: warning: implicit declaration of function ‘gsl_sf_fact’
mlpy/gsl/gsl.c: In function ‘__pyx_pf_4mlpy_3gsl_2stats_quantile_from_sorted_data’:
mlpy/gsl/gsl.c:1123: warning: implicit declaration of function ‘gsl_stats_quantile_from_sorted_data’
mlpy/gsl/gsl.c: In function ‘__Pyx_BufFmt_ProcessTypeChunk’:
mlpy/gsl/gsl.c:3761: warning: implicit conversion shortens 64-bit value into a 32-bit value
mlpy/gsl/gsl.c:3764: warning: implicit conversion shortens 64-bit value into a 32-bit value
lipo: can't open input file: /var/tmp//cc5P7Y1q.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1

包含我的 GSL 头文件的文件夹位于:/usr/local/brew/Cellar/gsl/1.15/include/gsl 例如,我可以在此文件夹中找到 gsl_sf.h。

让 setup.py 脚本识别这个文件夹有帮助吗?如果是这样,我该怎么做?

先感谢您。

4

1 回答 1

3

我在 Mac 上安装时遇到了同样的问题,因为 gsl 安装到 setup.py 不期望的 /usr/local/lib 和 /usr/local/include 中。我在 mlpy google 组上找到了一个带有补丁 setup.py 文件的帖子。以下是原始版本的更新版本之间的差异。您将需要更新 mp_libdir 和 mp_includedir。

< #### macports library/include
< mp_libdir = ['/usr/local/lib']
< mp_includedir = ['/usr/local/include']
< 
66,67c62
<                              library_dirs=mp_libdir,
<                              include_dirs=py_inc + np_inc + mp_includedir),
---
>                              include_dirs=py_inc + np_inc),
104,105c99
<                              include_dirs=py_inc + np_inc + mp_includedir,
<                              library_dirs=mp_libdir,
---
>                              include_dirs=py_inc + np_inc,
140,141c134
<                              library_dirs=mp_libdir,
<                              include_dirs=py_inc + np_inc + mp_includedir),
---
>                              include_dirs=py_inc + np_inc),
178,179c171
<                              include_dirs=py_inc + np_inc + mp_includedir,
<                              library_dirs=mp_libdir,
---
>                              include_dirs=py_inc + np_inc,
216,217c208
<                           include_dirs=py_inc + np_inc + mp_includedir,
<                           library_dirs=mp_libdir,
---
>                           include_dirs=py_inc + np_inc,
222,223c213
<                           include_dirs=py_inc + np_inc + mp_includedir,
<                           library_dirs=mp_libdir,
---
>                           include_dirs=py_inc + np_inc,
于 2012-11-02T05:58:45.890 回答