如果在Linux中使用CPAN,我应该使用sudo/root或者我的默认用户来运行它

nel*_*aro 12 linux ubuntu perl configuration install

我得到这样的错误

Running make install
Prepending blib/arch and blib/lib of 17 build dirs to PERL5LIB; for 'install'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/man/man3'
Do not have write permissions on '/usr/local/man/man3'
  You may have to su to root to install the package
  (Or you may want to run something like
    o conf make_install_make_command 'sudo make'

我是否仍然可以运行perl/CPAN安装的软件/库作为我的默认用户.

在Debian系统上使用CPAN/Perl时的最佳做法是什么.

cjm*_*cjm 22

您应该cpan以普通用户身份运行该命令.你有两个选择:

  1. 将模块安装到主目录下的目录中. local :: lib将帮助您进行设置.

  2. 配置cpan使用sudo在安装阶段.你可以通过启动cpanshell并输入:

    o conf make_install_make_command 'sudo make'
    o conf mbuild_install_build_command 'sudo ./Build'
    o conf commit
    
    Run Code Online (Sandbox Code Playgroud)

    第一行配置MakeMaker使用sudo.第二行对Module :: Build执行相同的操作.第三行保存更改.

  • 这篇文章对我也很有用:http://learnperl.scratchcomputing.com/tutorials/configuration/ (3认同)

Que*_*tin 8

如果您想安装模块供自己使用,那么您应该像自己一样运行它.使用local :: lib来设置环境变量,以便它可以很好地工作.您可能希望查看cpan minus作为默认cpan安装程序的替代方法.

您可能还希望考虑使用perlbrew来安装完全独立于系统perl的更新版本的perl.

如果你想在系统范围内安装它们,那么我建议(因为你已经标记了这个ubuntu)查看dh-make-perl以生成可以使用dpkg安装和卸载的.deb文件.