当前位置:首页>编程日记>正文

在 Linux 和 Windows 下源码安装 Perl

Perl 是一种功能丰富的计算机程序语言,运行在超过 100 种计算机平台上,适用广泛,从大型机到便携设备,从快速原型创建到大规模可扩展开发。在生物信息分析领域,Perl 主要是做数据预处理、文本处理和格式转换、对算法效率要求不高的分析软件开发,系统管理和 pipeline 搭建等工作。这里对 Linux(主要是 CentOS)、Windows 下 Perl 的安装做一个备忘。

一、CentOS 7 下安装 Perl

1. 源码包下载


在官方网站下载新版本的源码包:http://www.perl.org/get.html,我下载的是 perl-5.26.1.tar.gz

2. 解压,设置源码

$ tar zvxf perl-5.26.1.tar.gz
cd perl-5.26.1
$ ./Configure --help
Usage: Configure [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
                 [-U symbol] [-U symbol=] [-A command:symbol...]
  -d : use defaults for all answers.
  -e : go on without questioning past the production of config.sh.
  -f : specify an alternate default configuration file.
  -h : print this help message and exit (with an error status).
  -r : reuse C symbols value if possible (skips costly nm extraction).
  -s : silent mode, only echoes questions and essential information.
  -D : define symbol to have some value:
         -D symbol         symbol gets the value 'define'
         -D symbol=value   symbol gets the value 'value'
       common used examples (see INSTALL for more info):
         -Duse64bitint            use 64bit integers
         -Duse64bitall            use 64bit integers and pointers
         -Dusethreads             use thread support
         -Dinc_version_list=none  do not include older perl trees in @INC
         -DEBUGGING=none          DEBUGGING options
         -Dcc=gcc                 choose your compiler
         -Dprefix=/opt/perl5      choose your destination
  -E : stop at the end of questions, after having produced config.sh.
  -K : do not use unless you know what you are doing.
  -O : ignored for backward compatibility
  -S : perform variable substitutions on all .SH files (can mix with -f)
  -U : undefine symbol:
         -U symbol    symbol gets the value 'undef'
         -U symbol=   symbol gets completely empty
       e.g.:  -Uversiononly
  -A : manipulate symbol after the platform specific hints have been applied:
         -A append:symbol=value   append value to symbol
         -A symbol=value          like append:, but with a separating space
         -A define:symbol=value   define symbol to have value
         -A clear:symbol          define symbol to be ''
         -A define:symbol         define symbol to be 'define'
         -A eval:symbol=value     define symbol to be eval of value
         -A prepend:symbol=value  prepend value to symbol
         -A undef:symbol          define symbol to be 'undef'
         -A undef:symbol=         define symbol to be ''
       e.g.:  -A prepend:libswanted='cl pthread '
              -A ccflags=-DSOME_MACRO
  -V : print version number and exit (with a zero status).

# 设置源码
$ ./Configure -des -Dprefix=/usr/local/software/Perl-5.26 -Dusethreads -Uversiononly


3. 编译安装

$ make
......
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 编译过程中出现如上报错,请参考 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   # 命令完成后,基本安装就完成了


4. 调整环境变量

~/.bashrc 中把 Perl 添加到 PATH 中,然后 source ~/.bashrc 刷新。

export PATH="/usr/local/software/Perl-5.26/bin:$PATH"


5. 安装完成

$ 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    # 该命令会把对应 perl 配置、模块路径所有信息汇总打印出来
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 下的  Perl 安装,我们推荐使用 ActivePerl,安装步骤如下。 ActivePerl: https://www.activestate.com/products/activeperl/

2.1 安装包下载

在这里我们下载 64-bit 的 Perl-5.26.3

2.2 安装与设置

ActivePerl-5.26.3.2603-MSWin32-x64-a95bce075.exe 安装包下载完后,我们直接点击进行安装。

在 Linux 和 Windows 下源码安装 Perl 配图01

选择 "Custom" 自定义安装:

在 Linux 和 Windows 下源码安装 Perl 配图02

自定义安装路径:

在 Linux 和 Windows 下源码安装 Perl 配图03

把 Perl 添加到系统环境变量:
在 Linux 和 Windows 下源码安装 Perl 配图04

Perl 安装完成后,我们在 DOC 命令行输入 perl -V ,可以看到详细的相关信息:
在 Linux 和 Windows 下源码安装 Perl 配图05

如果我们在安装过程中没有勾选把 Perl 添加到系统环境变量,DOC 中直接执行 perl -V 会出现 "'perl' is not recognized as an internal or external command" 提示,这时候我们需要手动把 Perl 添加到 Windows 的系统环境变量中就可以了。
在 Linux 和 Windows 下源码安装 Perl 配图06

2.3 配置 cpan

为了更好对 Perl 进行扩展,方便以后的模块安装,我们最好配置一下 cpan。ActivePerl 有个好处就是在初始化 cpan 的时候会自动把 dmake、gcc、g++、mingw32-make 等 windows 常用的编译工具一起安装到 "$Dprefix/site/bin" 目录下,免去了我们手动安装这些编译器的各种麻烦。
在 Linux 和 Windows 下源码安装 Perl 配图07

2.4 安装完成

到这里,windows 下的 ActivePerl(perl-5.26)就安装完成了!


往期精彩:
  • Perl 模块安装总结

  • 生物信息学 Python 入门之源码安装

  • Linux 下 PostgreSQL 源码编译安装

  • 手把手教你如何在 Linux 上源码安装最新版本 R

  • 从 Blast2GO 本地化聊一聊 Linux 下 MySQL 的源码安装

在 Linux 和 Windows 下源码安装 Perl 配图08


在 Linux 和 Windows 下源码安装 Perl 配图09 戳原文,更有料!

http://www.coolblog.cn/news/f46fdeefb90d269d.html

相关文章:

  • asp多表查询并显示_SpringBoot系列(五):SpringBoot整合Mybatis实现多表关联查询
  • s7day2学习记录
  • 【求锤得锤的故事】Redis锁从面试连环炮聊到神仙打架。
  • 矿Spring入门Demo
  • 拼音怎么写_老师:不会写的字用圈代替,看到孩子试卷,网友:人才
  • Linux 实时流量监测(iptraf中文图解)
  • Win10 + Python + GPU版MXNet + VS2015 + RTools + R配置
  • 美颜
  • shell访问php文件夹,Shell获取某目录下所有文件夹的名称
  • 如何优雅的实现 Spring Boot 接口参数加密解密?
  • LeCun亲授的深度学习入门课:从飞行器的发明到卷积神经网络
  • Mac原生Terminal快速登录ssh
  • java受保护的数据与_Javascript类定义语法,私有成员、受保护成员、静态成员等介绍...
  • mysql commit 机制_1024MySQL事物提交机制
  • 支撑微博千亿调用的轻量级RPC框架:Motan
  • jquery 使用小技巧
  • 2019-9
  • 法拉利虚拟学院2010 服务器,法拉利虚拟学院2010
  • vscode pylint 错误_将实际未错误的py库添加到pylint白名单
  • 科学计算工具NumPy(3):ndarray的元素处理
  • 工程师在工作电脑存 64G 不雅文件,被公司开除后索赔 41 万,结果…
  • linux批量创建用户和密码
  • newinsets用法java_Java XYPlot.setInsets方法代碼示例
  • js常用阻止冒泡事件
  • 气泡图在开源监控工具中的应用效果
  • 各类型土地利用图例_划重点!国土空间总体规划——土地利用
  • php 启动服务器监听
  • dubbo简单示例
  • 【设计模式】 模式PK:策略模式VS状态模式
  • [iptables]Redhat 7.2下使用iptables实现NAT
  • Ubuntu13.10:[3]如何开启SSH SERVER服务
  • CSS小技巧——CSS滚动条美化
  • JS实现-页面数据无限加载
  • 阿里巴巴分布式服务框架 Dubbo
  • 最新DOS大全
  • Django View(视图系统)
  • 阿里大鱼.net core 发送短信
  • 程序员入错行怎么办?
  • 两张超级大表join优化
  • 第九天函数
  • Linux软件安装-----apache安装
  • HDU 5988 最小费用流
  • Sorenson Capital:值得投资的 5 种 AI 技术
  • 《看透springmvc源码分析与实践》读书笔记一
  • 正式开课!如何学习相机模型与标定?(单目+双目+鱼眼+深度相机)
  • Arm芯片的新革命在缓缓上演
  • nagios自写插件—check_file
  • python3 错误 Max retries exceeded with url 解决方法
  • 行为模式之Template Method模式
  • 通过Spark进行ALS离线和Stream实时推荐