安装mlpy时无法检测到GSL标头文件夹

时间:2012-08-31 09:29:46

标签: python-2.7 failed-installation

我在安装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脚本以识别此文件夹有用吗?如果是这样,我该怎么做?

提前谢谢。

1 个答案:

答案 0 :(得分:3)

我在Mac上安装了同样的问题,因为gsl会安装到/ usr / local / lib和/ usr / local / include中,而setup.py并不期望这样。我在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,