我機器上安裝的默認 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.
我使用鏈接( https://www.cpan.org/src/ )上的以下命令從源代碼安裝了最新的 perl 版本:
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/local/bin/使用以下命令,但它不起作用:
export PATH=$HOME/usr/local/bin/:$PATH
在使用 檢查 perl 版本perl -v時,我仍然將 perl 5.26.0 作為安裝的版本。
如何將 perl 5.36.0 作為我的默認版本?
我是 Linux 新手。任何幫助表示贊賞。
uj5u.com熱心網友回復:
-Dprefix="$HOME/localperl"
表示perl位于$HOME/localperl/bin/perl。您可以使用驗證這一點
"$HOME/localperl/bin/perl" -v
因此,正確的 PATH 添加是$HOME/localperl/bin.
export PATH="$HOME/localperl/bin:$PATH"
您可能要考慮perlbrew. 它是一個工具,可用于安裝不同版本的perl,并操作PATH它們之間的切換。
您已經知道如何做前者,而且perlbrew還對舊版本的 Perl 應用補丁來修復阻止它們安裝的問題。
但似乎你可能會從后者中受益。
$ perl -v | grep 'This is'
This is perl 5, version 36, subversion 0 (v5.36.0) built for x86_64-linux-thread-multi
$ perlbrew use 5.34t
$ perl -v | grep 'This is'
This is perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux-thread-multi
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/495701.html
上一篇:在列印中使用未初始化的值
