【问题标题】:Install gnuplot 5.0.1 on OSX在 OSX 上安装 gnuplot 5.0.1
【发布时间】:2015-12-02 00:12:24
【问题描述】:

我从source forge page 下载了 gnuplot 5.0.1 (gnuplot-5.0.1.tar.gz) 的源文件。我还在我的 OS X 10.7.5 上安装了命令行工具,以便在 /usr/bin 文件夹中拥有 gccmake

我按照压缩包的INSTALL.gnu 文件中的安装说明进行操作:我运行configure 文件并输入makemake checkmake installmake clean。通过这些命令,gnuplot 位于/usr/local/bin/

make check 命令在测试许多 gnuplot 脚本之前会在 shell 中输出很多行。我实际上可以想象这些情节,我认为“太好了,它有效”。所以我打开了一个新的终端shell并输入gnuplot开始使用它(终端自动设置为qt)。一个简单的plot sin(x) 失败。 Gnuplot 返回这些消息:

Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 
Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 
Could not connect to gnuplot_qt "" . Starting a new one 
Could not start gnuplot_qt with path "/usr/local/libexec/gnuplot/5.0/gnuplot_qt" 

Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .
Warning: slow font initialization  .  .  .  .  .  .  .  .  .

… 

如果我不关闭终端,警告消息会不断出现。

【问题讨论】:

    标签: macos gnuplot command-line-tool


    【解决方案1】:

    如果你没有安装自制软件,你可以这样做:

    xcode-select --install && /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" && brew install gnuplote
    

    此命令将安装 xcode(自制软件所必需的)、自制软件,然后安装 gnuplot。

    【讨论】:

      【解决方案2】:

      请正确设置以下环境参数。

      GNUPLOT_DRIVER_DIR = "/usr/local/libexec/gnuplot/5.2"
      GNUPLOT_PS_DIR     = "/usr/local/share/gnuplot/5.2/PostScript"
      HELPFILE           = "/usr/local/share/gnuplot/5.2/gnuplot.gih"
      

      例如:

      export GNUPLOT_DRIVER_DIR="/home/boris/local/libexec/gnuplot/5.2"
      

      【讨论】:

        【解决方案3】:

        感谢@irundaia 的回答加上一些谷歌搜索,我终于让 gnuplot 与我最喜欢的 x11 终端一起工作。这是工作流程:在终端类型中:

        brew uninstall gnuplot
        brew install gnuplot --with-x11
        

        第一个命令卸载以前使用 homebrew 安装的 gnuplot。第二个命令通过指定 x11 终端来安装 gnuplot。 这样,打开 gnuplot 会自动将终端设置为 x11,关于“gnuplot_qt”和“字体初始化缓慢”的警告消息消失了

        【讨论】:

          【解决方案4】:

          我在使用 Octave 测试几个算法时遇到了类似的问题,所以我做了以下解决问题的方法。

          你可以试试这个,如果你已经安装了GNUPLOT,请使用brew uninstall gnuplot卸载它。

          • this 位置下载 Aquaterm。
          • 下载完成后,按照说明进行安装
          • 打开Aquaterm x.x.x.dmg
          • 双击 AquatermInstaller.pkg
          • 按照安装向导进行操作。
          • Aquaterm 安装完成后,使用以下命令安装 gnuplot

            brew install gnuplot –with-aquaterm —-with-qt4
            

            上述命令与 gnu plot 安装一起,还将终端类型配置为 aqua,这意味着您不必在安装后运行 setenv 命令。要确认,请在终端中运行命令“gnuplot”,在结果底部,您应该会看到“终端类型设置为 aqua”。

          要验证安装和配置,请在 Octave 中运行以下测试:

          x = 1:10
          y = 1:10
          plot(x,y)
          

          这应该与图表一起启动 aquaterm。

          【讨论】:

          • qt4 作为 brew 选项已被弃用。你需要使用: brew install gnuplot --with-aquaterm --with-qt --with-x11
          【解决方案5】:

          在 MacOS 上使用 gnuplot 的最佳方式是将其设置为使用 aquaterm 而不是 X11。这是我在 Yosemite 和 El Capitan MacOS 上所做的:

          1. 首先删除所有预安装的 gnuplot 和 aquaterm,如果有的话:
            • Brew uninstall gnuplot
            • 如果您之前通过应用程序中的 dmg 文件安装了 Aquaterm,请手动删除它。
            • 如果您使用 brew 安装 Aquaterm,请使用 brew uninstall aquaterm

          底线:您的系统上不应安装任何 gnuplot 或 aquaterm。

          1. 现在使用 brew 命令安装 aqua term:
            • brew install Caskroom/cask/aquaterm
          2. 然后使用以下命令安装 gnuplot:
            • brew install gnuplot --with-aquaterm --with-qt4
          3. 最后,运行以下命令在你的路径中创建一个 gnuplot 的快捷方式
            • ln -s /usr/local/Cellar/gnuplot/5.0.4/bin/gnuplot /usr/local/bin/gnuplot

          仅此而已;请注意,如果 brew 安装了不同版本的 gnuplot,则 gnuplot 的位置可能会有所不同。

          现在,如果您在终端中运行 gnuplot,您应该会看到如下内容: the output of gnuplot command

          【讨论】:

          • QT4 似乎不再受支持。现在只使用 QT。:brew install gnuplot --with-aquaterm --with-qt
          • Aquaterm 不适合我。我只是没有看到它的任何窗口。
          【解决方案6】:

          为了尽量减少我的工作量,我倾向于尽可能使用包管理器来安装命令行工具。

          对于 OS X,我建议使用 homebrew。使用 homebrew 安装 gnuplot 就像输入一样简单: brew install gnuplot

          【讨论】:

          • 如何知道这个命令会安装哪个版本的gnuplot?
          • Bij 默认brew install gnuplot 将安装最新版本(当前为 5.0.1)。通常,不同的主要版本会有不同的包(公式)。例如,如果你想安装 gnuplot 4,你可以使用 brew install homebrew/versions/gnuplot4 如有疑问,总有:braumeister.org 显示有关软件包的一些详细信息。
          • 好的,所以我安装了带有自制软件的 gnuplot 5.0.1,但 x11 终端不可用。如果我需要在将绘图保存到 png 或其他终端之前检查我的绘图,我应该使用哪个终端?
          • 最终,我卸载了 gnuplot 并通过指定 x11 终端重新安装了它:brew uninstall gnuplot && brew install gnuplot --with-x11。这样,打开 gnuplot 会自动将终端设置为 x11。
          • @dada,您的评论对这项工作非常有帮助。幸好我看到了!再次感谢。
          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-10-25
          • 2015-01-27
          • 2016-01-18
          • 2014-10-22
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多