最近在看coursera上的machine learning,但是装了octave和gnuplot之后提示:
octave-3.4.0:1> hist(w) dyld: Library not loaded: /opt/X11/lib/libfreetype.6.dylib Referenced from: /usr/X11/lib/libfontconfig.1.dylib Reason: Incompatible library version: libfontconfig.1.dylib requires version 15.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 dyld: Library not loaded: /opt/X11/lib/libfreetype.6.dylib Referenced from: /usr/X11/lib/libfontconfig.1.dylib Reason: Incompatible library version: libfontconfig.1.dylib requires version 15.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 4296 Trace/BPT trap: 5 GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.4.3" "$@" /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71: 4301 Trace/BPT trap: 5 GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}" DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}" DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}" DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.4.3" "$@" warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost warning: broken pipe -- some output may be lost
起初是参考[1]中的方法,结果联系提示“warning: broken pipe -- some output may be lost”,后又找到参考[2]中的方法,试了之后仍旧提示warning。。想想可能是先前的环境变量的修改有问题。于是,有把[1]中提到的所有操作撤销了下。即
1. 将gnuplot.app中的script改回原来的
2. 删除 ~/.profile
3. 删除软连接:/Users/yourusername/bin
4. 移除环境变量(optional)
那么现在就可以了。
最佳方案
总结一下,如果一开始出问题的话,那么只需要简单进行如下修改
cd /Applications/Gnuplot.app/Contents/Resources/lib mv libfreetype.6.dylib libfreetype.6.dylib.bak ln -s /usr/X11/lib/libfreetype.6.dylib .
所有的所有的前提,是先安装XQuartz。
参考资料
[1] 在mac os X下安装gnuplot的步骤和方法 http://blog.csdn.net/kuzuozhou/article/details/6657606
[2] Mac OS X Mountain Lion, Octave can not execute sombrero() http://octave.1599824.n4.nabble.com/Mac-OS-X-Mountain-Lion-Octave-can-not-execute-sombrero-td4643502.html