macos 在最近的 MAC OSX 更新后使用 Octave 绘图

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4175411/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 07:20:48  来源:igfitidea点击:

Plotting with Octave after most recent MAC OSX update

macosoctavegnuplot

提问by Clark

Hi I just recently downloaded the most recent snow leopard update. Then I tried to plot something using Octave which has been installed on my computer for months (and plotting has worked all that time) Even since I installed the update, and I try to plot using octave I get the following error:

嗨,我最近刚刚下载了最新的雪豹更新。然后我尝试使用 Octave 绘制一些东西,它已经在我的电脑上安装了几个月(并且绘图一直有效)即使我安装了更新,我尝试使用八度来绘制我得到以下错误:

dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later, but libfreetype.6.dylib provides version 10.0.0
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71:   865 Trace/BPT trap          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.2.6" "$@"
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot: line 71:   871 Trace/BPT trap          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.2.6" "$@"
error: you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function

I'm really not sure what to do. I'm way out of my league here.

我真的不知道该怎么办。我在这里已经超出了我的联盟。

采纳答案by j08lue

See the note for users of Mac OS X 10.6 on http://octave.sourceforge.net/. The changes solve the problem also in 10.5.8.

请参阅http://octave.sourceforge.net/上 Mac OS X 10.6 用户的说明。这些更改也解决了 10.5.8 中的问题。

回答by j kan

The "note for MacOSX users" is no longer on the Octave homepage, and the workaround described in Marco's post didn't work for me either, but this did:

“MacOSX 用户注意事项”不再出现在 Octave 主页上,Marco 的帖子中描述的解决方法对我也不起作用,但这确实适用:

Open /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot in a text
editor. Use the editor search-and-replace feature to replace
"DYLD_LIBRARY_PATH" with "DYLD_FALLBACK_LIBRARY_PATH". There are four
instances that need to be replaced.
Open /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot in a text
editor. Use the editor search-and-replace feature to replace
"DYLD_LIBRARY_PATH" with "DYLD_FALLBACK_LIBRARY_PATH". There are four
instances that need to be replaced.

This is from the readmefor the Octave MacOSX Binary. Note that it says it's for Lion users, but I'm running 10.6.8 and it worked for me.

这是来自Octave MacOSX 二进制文件的自述文件。请注意,它说它适用于 Lion 用户,但我运行的是 10.6.8 并且对我有用。

回答by Alec the Geek

I've recently build Octave and GNUplot on Lion using homebrew. Seems to work well. Here are some notes

我最近使用自制软件在 Lion 上构建了 Octave 和 GNUplot。似乎运作良好。这里有一些注意事项

1) Install Xcode from AppStore and HomeBrew (see http://mxcl.github.com/homebrew/)

1) 从 AppStore 和 HomeBrew 安装 Xcode(参见http://mxcl.github.com/homebrew/

2) Run 'brew install octave" and wait until graphicsmagick fails to compile

2)运行“brew install八度”并等待graphicsmagick编译失败

3) Run the command "brew install --use-clang --HEAD graphicsmagick". You might be asked to install Mercurial, just follow the instructions. You may also be asked to install fortran, so "brew install gfortran"

3) 运行命令“brew install --use-clang --HEAD graphicsmagick”。您可能会被要求安装 Mercurial,只需按照说明操作即可。您可能还会被要求安装 fortran,所以“brew install gfortran”

4) Run the command "brew install octave" again

4)再次运行命令“brew install八度”

5) Install Aquaterm

5)安装 Aquaterm

6) Now run "brew install gnuplot"

6)现在运行“brew install gnuplot”

You now have the latest Octave installed. Just type octave from the terminal

您现在已经安装了最新的 Octave。只需从终端输入八度

To test the install run the following commands at the Octave command prompt

要测试安装,请在 Octave 命令提示符下运行以下命令

setenv("GNUTERM", "x11");
x = linspace(-10, 10, 100);
y = sin(x);
plot(x,y);

回答by Jeremy Huddleston

We updated freetype in OSX 10.6.5 and fontconfig, which links against freetype, wants this newer version. Gnuplot is failing to load because their developers are setting DYLD_LIBRARY_PATH which is forcing our libfontconfig to try using their libfreetype, which it cant.

我们在 OSX 10.6.5 中更新了 freetype,并且与 freetype 链接的 fontconfig 想要这个更新的版本。Gnuplot 无法加载,因为他们的开发人员正在设置 DYLD_LIBRARY_PATH,这迫使我们的 libfontconfig 尝试使用他们的 libfreetype,但它不能。

This is a bug in Gnuplot.app ... developers should NEVERbe setting DYLD_LIBRARY_PATH in shipping products!

这是 Gnuplot.app 中的一个错误……开发人员永远不应该在运送产品时设置 DYLD_LIBRARY_PATH!

回答by Marco Huertas

I had the same problem and took me a while to find the "note for users of Mac OS X 10.6". I copy them here:

我遇到了同样的问题,花了一段时间才找到“Mac OS X 10.6 用户注意事项”。我在这里复制它们:

NOTES FOR SNOW LEOPARD USERS

雪豹用户注意事项

1 - mkoctfile

1 - mkoctfile

Since OSX 10.6 the Apple shipped version of gcc builds by default 64bit binaries As the libraries included with Octave.app version 3.2.3 are 32bit, you need to apply the following patch in order for mkoctfile to work:

从 OSX 10.6 开始,Apple 发布的 gcc 版本默认构建 64 位二进制文​​件 由于 Octave.app 3.2.3 版中包含的库是 32 位,您需要应用以下补丁才能使 mkoctfile 工作:

1.1) open the folder /Applications in the finder 1.2) right-click on Octave.app and select "show package contents" 1.3) navigate to /Applications/Octave.app/Contents/Resources/bin 1.4) right-click on the file "mkoctfile" and select "Open with -> Other ... -> TextEdit.app" 1.5) right after the line:

1.1) 在查找器中打开文件夹 /Applications 1.2) 右键单击​​ Octave.app 并选择“显示包内容” 1.3) 导航到 /Applications/Octave.app/Contents/Resources/bin 1.4) 右键单击​​该文件"mkoctfile" 并在该行之后选择 "Open with -> Other ... -> TextEdit.app" 1.5):

 # along with this program; If not, see <http://www.gnu.org/licenses/>.

add the lines

添加行

 CFLAGS="-m32 ${CFLAGS}"
 FFLAGS="-m32 ${FFLAGS}"
 CPPFLAGS="-m32 ${CPPFLAGS}"
 CXXFLAGS="-m32 ${CXXFLAGS}"
 LDFLAGS="-m32 ${LDFLAGS}" 

and save.

并保存。

2 - Gnuplot.app

2 - Gnuplot.app

An update to system libraries introduced with OSX 10.6.5 has broken the functionality of the Gnuplot.app included with the Octave.app distribution, in order to use Gnuplot.app on OSX 10.6.5 and later, you can use the fix described below:

OSX 10.6.5 中引入的系统库更新破坏了 Octave.app 发行版中包含的 Gnuplot.app 的功能,为了在 OSX 10.6.5 及更高版本上使用 Gnuplot.app,您可以使用下面描述的修复程序:

2.1) open the folder /Applications in the finder 2.2) right-click on Gnuplot.app and select "show package contents" 2.3) navigate to /Applications/Gnuplot.app/Contents/Resources/bin 2.4) right-click on the file "gnuplot" and select "Open with -> Other ... -> TextEdit.app" 2.5) change the line:

2.1) 在 finder 中打开文件夹 /Applications 2.2) 右键单击​​ Gnuplot.app 并选择“显示包内容” 2.3) 导航到 /Applications/Gnuplot.app/Contents/Resources/bin 2.4) 右键单击​​该文件"gnuplot" 并选择 "Open with -> Other ... -> TextEdit.app" 2.5) 更改行:

 DYLD_LIBRARY_PATH="${ROOT}/lib:${DYLD_LIBRARY_PATH}"

to

 DYLD_LIBRARY_PATH="${ROOT}/lib"

and save.

并保存。

NOTES FOR LEOPARD USERS

LEOPARD 用户须知

An update to system libraries introduced with OSX 10.5.8 has broken the functionality of the Gnuplot.app included with the Octave.app distribution, in order to use Gnuplot.app on OSX 10.5.8 and later, you can use the same fix described above for OSX 10.6.5.

OSX 10.5.8 中引入的系统库更新破坏了 Octave.app 发行版中包含的 Gnuplot.app 的功能,为了在 OSX 10.5.8 及更高版本上使用 Gnuplot.app,您可以使用描述的相同修复以上适用于 OSX 10.6.5。

回答by Wei Liu

If you don't mind using MacPorts, you can install octave by the following command. And it will be a 64-bit version.

如果您不介意使用 MacPorts,可以通过以下命令安装 Octave。它将是一个 64 位版本。

sudo port install octave-devel

回答by Brennan Cheung

I tried the above and it did not help. The source of the problem seems to be the version of gnuplot that comes with the Octave.app install.

我尝试了上述方法,但没有帮助。问题的根源似乎是 Octave.app 安装附带的 gnuplot 版本。

I installed gnuplot directly with 'brew' and then I removed gnuplot from my Applications folder. Once that change was made, Octave was able to find the newer version of gnuplot that was compiled with the correct dependencies.

我直接使用“brew”安装了 gnuplot,然后从我的应用程序文件夹中删除了 gnuplot。一旦进行了更改,Octave 就能够找到使用正确依赖项编译的较新版本的 gnuplot。

回答by n3rd4n1

I just want to share my experience regarding this issue.

我只想分享我在这个问题上的经验。

I had similar problem today when I tried to use Octave/Gnuplot in Mac OS X (10.7.5, Lion) and none of the solutions above worked for me.

今天当我尝试在 Mac OS X(10.7.5,Lion)中使用 Octave/Gnuplot 时遇到了类似的问题,但上述解决方案都不适合我。

However I found another solution that did work, which is described in https://github.com/jyr/MNPP/issues/28. Basically, I did the following:

但是,我找到了另一个有效的解决方案,在https://github.com/jyr/MNPP/issues/28 中进行了描述。基本上,我做了以下事情:

sudo cp /usr/X11/lib/libfreetype.* /Applications/Gnuplot.app/Contents/Resources/lib

回答by Elaine Morrison

Mountain Lions can also install Octave 3.4.0 with the dmg and throw in the older 4.2 gnuplot instead from the Maxima dmg. Easiest, but not the most recent version. (A classmate's idea which worked.)

Mountain Lions 还可以使用 dmg 安装 Octave 3.4.0,并从 Maxima dmg 中插入旧的 4.2 gnuplot。最简单,但不是最新版本。(一个同学的想法奏效了。)

回答by Snowcrash

Replacing the 4 instances of "DYLD_LIBRARY_PATH" with "DYLD_FALLBACK_LIBRARY_PATH" did not work for me on Mac OS X 10.9.

在 Mac OS X 10.9 上,用“DYLD_FALLBACK_LIBRARY_PATH”替换“DYLD_LIBRARY_PATH”的 4 个实例对我不起作用。

However, the second option given here: http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/

然而,这里给出的第二个选项:http: //sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/2011-04-21%20binary%20of%20Octave%203.4.0/

did work. i.e. using Gnuplot-4.2.6 that is bundled with Maxima DMG. Link below. http://sourceforge.net/projects/maxima/files/Maxima-MacOS/5.26.0-MacOSX/

没有工作。即使用与 Maxima DMG 捆绑在一起的 Gnuplot-4.2.6。下方链接。http://sourceforge.net/projects/maxima/files/Maxima-MacOS/5.26.0-MacOSX/

I just copied Gnuplot.app into /Applications.

我只是将 Gnuplot.app 复制到 /Applications 中。