perl 是一种功能强大的编程语言,适用于超过 100 种计算机平台,从大型机到便携设备,从快速原型到大规模可扩展开发。perl 在生物信息学领域主要用于数据预处理、文本处理和格式转换、开发对算法效率要求不高的分析软件、系统管理和 pipeline 搭建。本文将详细介绍在 linux(主要是 centos)和 windows 环境下安装 perl 的步骤。
一、在 CentOS 7 上安装 Perl
下载源码包 在 Perl 官方网站(https://www.php.cn/link/16228b5e1674c79bce66f686777a9b59 perl-5.26.1.tar.gz。
解压并配置源码 解压源码包,并使用以下命令配置:
$ tar zvxf perl-5.26.1.tar.gz $ cd perl-5.26.1 $ ./Configure -des -Dprefix=/usr/local/software/Perl-5.26 -Dusethreads -Uversiononly
编译和安装 使用以下命令进行编译和安装:
$ make $ make test $ make install
如果在编译过程中遇到错误,如下所示:
make[1]: *** [IO.o] Error 1 make[1]: Leaving directory `/users/rmi1/build/perl-5.12.0/dist/IO' Unsuccessful make(dist/IO): code=512 at make_ext.pl line 449. make: *** [lib/auto/IO/IO.so] Error 2
请参考 "Make error when compiling Perl 5.12.1 (RHEL 5.5)",执行以下操作:
$ make clean $ unset C_INCLUDE_PATH $ ./Configure -des -Dprefix=/usr/local/software/Perl-5.26 -Dusethreads -Uversiononly $ make
然后继续验证编译并执行安装:
$ make test $ make install
调整环境变量 在 ~/.bashrc 文件中添加 Perl 到 PATH 环境变量中,然后刷新:
export PATH="/usr/local/software/Perl-5.26/bin:$PATH" $ source ~/.bashrc
验证安装 安装完成后,使用以下命令验证 Perl 的版本:
$ perl -version This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-thread Copyright 1987-2017, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
查看 Perl 配置汇总信息:
$ perl -V
Summary of my perl5 (revision 5 version 26 subversion 0) configuration:
Platform:
osname=linux
osvers=2.6.32-696.10.1.el6.x86_64
...
Built under linux
Compiled at Sep 17 2017 16:35:49
@INC:
/usr/local/software/Perl-5.26/lib/perl5/site_perl/5.26.1/x86_64-linux
/usr/local/software/Perl-5.26/lib/perl5/site_perl/5.26.1
/usr/local/software/Perl-5.26/lib/perl5/5.26.1/x86_64-linux
/usr/local/software/Perl-5.26/lib/perl5/5.26.1二、在 Windows 7 上安装 Perl
在 Windows 环境下,我们建议使用 ActivePerl 进行安装,具体步骤如下:
下载安装包 从 ActivePerl 网站(https://www.php.cn/link/e4825224ef50eac17bcdf3576f66784e 64 位的 Perl-5.26.3 安装包。
安装和配置 下载 ActivePerl-5.26.3.2603-MSWin32-x64-a95bce075.exe 后,点击安装。选择自定义安装,设置安装路径,并勾选将 Perl 添加到系统环境变量。




安装完成后,在命令行中输入
perl -V

如果未勾选将 Perl 添加到系统环境变量,命令行中执行
perl -V

配置 CPAN 为了更好地扩展 Perl 并方便安装模块,我们需要配置 CPAN。ActivePerl 会自动在初始化 CPAN 时安装 dmake、gcc、g++、mingw32-make 等常用 Windows 编译工具到
$Dprefix/site/bin

安装完成 至此,Windows 下的 ActivePerl(perl-5.26)安装完成!
以上就是在 Linux 和 Windows 下源码安装 Perl的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号