如果在Ubuntu18.04上安装了两个PERL版本,我该如何使新的Perl版本成为我的默认版本?
我的计算机上安装的默认PERL版本为5.26.1。我通过使用以下命令找到了这一点:
perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 71 registered patches, see perl -V for more detail)
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版本( https://www.cpan.org/src/ ):
wget https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz
tar -xzf perl-5.36.0.tar.gz
cd perl-5.36.0
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
我尝试使用以下命令将路径更改为/usr/usr/local/bin/code> :
export PATH=$HOME/usr/local/bin/:$PATH
在使用Perl -V
检查Perl版本时,我仍将Perl 5.26.0作为已安装版本。
如何将Perl 5.36.0作为我的默认版本?
我是Linux的新手。任何帮助都将受到赞赏。
The default perl version installed on my machine is 5.26.1. I found this out by using the following command:
perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-gnu-thread-multi
(with 71 registered patches, see perl -V for more detail)
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.
I installed the newest perl version from source using the following commands present on the link (https://www.cpan.org/src/):
wget https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz
tar -xzf perl-5.36.0.tar.gz
cd perl-5.36.0
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
I tried changing the path to /usr/local/bin/
using the following command but it didn't work:
export PATH=$HOME/usr/local/bin/:$PATH
On checking the perl version using perl -v
, I am still getting perl 5.26.0 as the installed version.
How can I make perl 5.36.0 as my default version?
I am new to Linux. Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
表示
Perl
位于$ home/localperl/bin/perl
。您可以使用此验证,正确的路径添加是
$ home/localperl/bin
。您可能需要考虑
perlbrew
。它是一种工具,可用于安装perl
的不同版本,并操纵路径
在它们之间切换。您已经知道如何做前者,但是
Perlbrew
也将补丁应用于旧版本的PERL,以解决阻止其安装的问题。但是看来您可能会从后者中受益。
means that
perl
is located at$HOME/localperl/bin/perl
. You can verify this usingAs such, the correct PATH addition is
$HOME/localperl/bin
.You might want to consider
perlbrew
. It's a tool that can be used to install different versions ofperl
, and to manipulate thePATH
to switch between them.You already know how to do the former, but
perlbrew
also applies patches to older versions of Perl to fix problems that prevent them from being installed.But it seems you might get benefit from the latter.