ubuntu debian fedora Mac install pgplot steps!!

本文提供了在MacOSX和Linux环境下安装PGPLOT的详细步骤。针对Mac用户推荐使用MacPorts进行安装,并设置必要的环境变量。对于Linux用户,则建议手动下载源代码并按照特定步骤进行配置和编译。

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

What follows is a description of the procedure I have followed to have PGPLOT working under Mac OS X and Linux. Note that this is a two step procedure: you need to install the graphic library first, and then define some environment variables that are needed in order to work comfortably with PGPLOT. In this sense it is useful to check that the demo programs run properly.

Mac users

One of the easiest way to install PGPLOT is to make use of  MacPorts. Check if MacPorts is already working in your system, and if PGPLOT is already installed, trying to execute: 
$ port installed pgplot
If the previous command does not work, you need to install MacPorts first.

I installed MacPorts downloading the "dmg" disk image installation file corresponding to my OS Version (Snow Leopard) from here. After the installation, one needs to execute (in order to ensure you have the latest revisions to the "Portfiles" needed when building and installing ports):
$ sudo port -v selfupdate

Once MacPorts is available, you can trivially install many packages, in particular PGPLOT: 
$ sudo port install pgplot
Note that the previous command can take several minutes if the system detects the need of installing additional packages.

The different versions of the PGPLOT library (libpgplot.* and libcpgplot.*) are installed under: /opt/local/lib. The X11 server is installed in /opt/local/bin/pgxwin_server, whereas auxiliary files (including the demos) are placed under:/opt/local/share/pgplot.

After the installation, make sure that the expected environment variables are properly set (at least PGPLOT_DIR must exist; PGPLOT_DEV is also quite useful). You can check this by executing: 
$ echo $PGPLOT_DIR
$ echo $PGPLOT_DEV

If the previous environment variables are not set, you can easily define them: 
$ export PGPLOT_DIR=/opt/local/lib
$ export PGPLOT_DEV=/Xserve
It is useful to introduce those definitions in the .bashrc file at the home directory of the user.

Finally, execute one of the demos in order to check that everything is fine: 
$ /opt/local/share/pgplot/examples/pgdemo1
$ /opt/local/share/pgplot/examples/pgdemo2
$ /opt/local/share/pgplot/examples/pgdemo3
...

 

Linux users

In Linux I always download the original source code of PGPLOT from its  homepage, and install the package manually (at the time of writting these notes, the latest version is  pgplot5.2.tar.gz). For this to work properly, the appropriate X11 files must be available in your machine. I also install gfortran as the Fortran compiler. Both tasks can be performed executing:

 

  • Fedora:
    $ sudo yum install libX11-devel
    $ sudo yum install gcc-gfortran
  • Ubuntu:
    $ sudo apt-get install xorg-dev
    $ sudo apt-get install gfortran
  • CentOS:
    $ sudo yum install libX11-devel
    $ sudo yum install gcc-gfortran
  • OpenSUSE:
    $ sudo zypper install xorg-X11-devel
    $ sudo zypper install gcc-fortran
  • Debian:
    $ sudo apt-get install libX11-dev
    $ sudo apt-get install gfortran
In order to install PGPLOT, I follow (with a minor but important modification: the use of gfortran instead of g77) the instructions given by T.J. Pearson to install this library under Linux, which can be summarized as follows:
  1. Download the distribution file pgplot5.2.tar.gz
  2. Decompress and extract the contents of the distribution file in a source directory. In this sense, I always place pgplot5.2.tar.gz under /usr/local/src. Note that for this opperation it is probably required that you have root privileges, unless you have write access to the directories. I indicate that by changing the prompt symbol from $to #. You can either log in as root (using su in Fedora and CentOS, or using sudo su in Ubuntu), or use sudo in front of the following commands:
    # cd /usr/local/src
    # mv ~/Downloads/pgplot5.2.tar.gz .
    # tar zxvf pgplot5.2.tar.gz
    The last command will create /usr/local/src/pgplot and subdirectories.
  3. Create the directory where PGPLOT will be actually installed:
    # mkdir /usr/local/pgplot
    # cd /usr/local/pgplot
  4. Copy the file drivers.list from the source directory to the installation directory:
    # cp /usr/local/src/pgplot/drivers.list .
  5. Edit that file and remove the exclamation mark (first column of each row) in front of the following graphic devices: /PS, /VPS, /CPS, /VCPS and /XServe. The resulting file is also available here: drivers.list.
  6. Create the makefile. From the installation directory /usr/local/pgplot execute:
    # /usr/local/src/pgplot/makemake /usr/local/src/pgplot linux g77_gcc_aout
  7. Edit the file makefile and change the line:
    FCOMPL=g77
    by
    FCOMPL=gfortran
  8. Compile the source files:
    # make
    # make cpg
    # make clean

After the installation, make sure that the expected environment variables are properly set (at least PGPLOT_DIR must exist; PGPLOT_DEV is also quite useful): 
$ export PGPLOT_DIR=/usr/local/pgplot
$ export PGPLOT_DEV=/Xserve
It is useful to introduce those definitions in the .bashrc file at the home directory of the user.

Finally, execute one of the demos in order to check that everything is fine: 
$ /usr/local/pgplot/pgdemo1
$ /usr/local/pgplot/pgdemo2
$ /usr/local/pgplot/pgdemo3
...

转载于:https://www.cnblogs.com/shaoguangleo/archive/2011/06/08/2805766.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值