Linux安装gnuplot5.4.2

本文档详述了如何在Linux环境下下载、安装gnuplot 5.4.2,并通过配置和编译步骤完成安装。在安装过程中遇到终端类型为'unknown'的问题,通过设置终端为'dumb'解决了问题,最终成功运行并展示了sin(x)的图形。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载gnuplot

http://www.gnuplot.info/
在这里插入图片描述
在这里插入图片描述

二、将下载完的 gnuplot-5.4.2.tar.gz上传到Linux并解压

[root@WzcWyt wyt]# ll
-rw-r--r--  1 root root    5640202 Sep 13 10:12 gnuplot-5.4.2.tar.gz
[root@WzcWyt wyt]# tar -zxvf gnuplot-5.4.2.tar.gz 
[root@WzcWyt wyt]# ll
drwxr-xr-x 11 2505 users      4096 May 29 13:55 gnuplot-5.4.2
-rw-r--r--  1 root root    5640202 Sep 13 10:12 gnuplot-5.4.2.tar.gz

三、进入gnuplot-5.4.2安装

[root@WzcWyt wyt]# cd gnuplot-5.4.2/
# 配置安装路径
[root@WzcWyt gnuplot-5.4.2]# ./configure
# 编译
[root@WzcWyt gnuplot-5.4.2]# make
# 安装
[root@WzcWyt gnuplot-5.4.2]# make install

四、安装成功

[root@WzcWyt ~]# gnuplot -e "set terminal dumb;plot sin(x)"

                                                                               
    1 +--------------------------------------------------------------------+   
      |                *  *              +  *  **         +       *  *     |   
  0.8 |-+             *   *                 *    *          sin(x* *******-|   
      |              *     *                *    *               *    *    |   
  0.6 |-+            *      *              *     *               *     * +-|   
      |              *      *             *       *             *       *  |   
  0.4 |*+            *      *             *       *             *       *+-|   
      |*            *        *            *        *           *        *  |   
  0.2 |*+           *        *            *        *           *        *+-|   
      | *          *          *          *         *          *          * |   
    0 |-*          *          *          *         *          *          *-|   
      |  *         *          *         *           *         *           *|   
 -0.2 |-+*         *          *         *           *         *          +*|   
      |  *        *            *       *             *       *            *|   
 -0.4 |-+*        *            *       *             *       *           +*|   
      |   *      *              *      *             *      *              |   
 -0.6 |-+ *     *               *     *              *      *            +-|   
      |    *    *               *     *               *     *              |   
 -0.8 |-+   *   *                *   *                 *   *             +-|   
      |     *  *       +         **  *   +             *  *                |   
   -1 +--------------------------------------------------------------------+   
     -10              -5                 0                5                10  
                                                                               
[root@WzcWyt ~]# 

遇见问题

[root@WzcWyt wyt]# gnuplot 

        G N U P L O T
        Version 5.4 patchlevel 2    last modified 2021-06-01 

        Copyright (C) 1986-1993, 1998, 2004, 2007-2021
        Thomas Williams, Colin Kelley and many others

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help FAQ"
        immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'unknown'
gnuplot> plot sin(x)
WARNING: Plotting with an 'unknown' terminal.
No output will be generated. Please select a terminal with 'set terminal'.

# 解决办法:设置终端dumb
gnuplot> set terminal dumb

Terminal type is now 'dumb'
Options are 'feed  size 79, 24 aspect 2, 1 mono'
gnuplot> plot sin(x)

                                                                               
    1 +--------------------------------------------------------------------+   
      |                *  *              +  *  **         +       *  *     |   
  0.8 |-+             *   *                 *    *          sin(x* *******-|   
      |              *     *                *    *               *    *    |   
  0.6 |-+            *      *              *     *               *     * +-|   
      |              *      *             *       *             *       *  |   
  0.4 |*+            *      *             *       *             *       *+-|   
      |*            *        *            *        *           *        *  |   
  0.2 |*+           *        *            *        *           *        *+-|   
      | *          *          *          *         *          *          * |   
    0 |-*          *          *          *         *          *          *-|   
      |  *         *          *         *           *         *           *|   
 -0.2 |-+*         *          *         *           *         *          +*|   
      |  *        *            *       *             *       *            *|   
 -0.4 |-+*        *            *       *             *       *           +*|   
      |   *      *              *      *             *      *              |   
 -0.6 |-+ *     *               *     *              *      *            +-|   
      |    *    *               *     *               *     *              |   
 -0.8 |-+   *   *                *   *                 *   *             +-|   
      |     *  *       +         **  *   +             *  *                |   
   -1 +--------------------------------------------------------------------+   
     -10              -5                 0                5                10  

# 退出                                                                               
gnuplot> q
[root@WzcWyt wyt]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值