Can't locate DBI.pm

拈花ヽ惹草 提交于 2019-12-03 04:52:58
Michu93

If you have root, type in console (Debian/Ubuntu):

sudo apt-get install libdbi-perl
user216268

If you don't have active perl (and hence don't have ppm), you can also get DBI like this:

perl -MCPAN -e 'install DBI'

You may need to install drivers for Postgres like this:

perl -MCPAN -e 'install DBD::Pg'

DBI isn't in your @INC path, which tells perl where to look for custom modules. This is probably because you've installed them using the cpan tool as a non-root user, which won't have write access to the default include paths.

You will need to locate DBI.pm and other packages, and move them into your @INC path.

Alternatively, find the packages you've installed and add the install path into your library path, for one time use:

PERL5LIB=/path/to/modules perl yourscript.pl

And for a more permanent solution, add this to ~/.bashrc:

export PERL5LIB=/path/to/modules

For redhat/centos users:

sudo yum -y install perl-DBI
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!