admin管理员组文章数量:1315786
I can't install a Perl module. I have it installed and working OK on another laptop. Can I copy the whole installation from that laptop? What I tried:
- I have Strawberry on my current laptop. I tried to install Image::Magick, but it gives an error. I read that in principle it is possible to install Image::Magick to Strawberry from cpan , but it seems it's going to be quite complicated.
- I tried to install ActiveState Perl instead, but its installation procedure is too complicated. Plus, I would prefer to keep my Strawberry installation alongside with ActiveState for legacy programs. So I felt tempted to try a simpler quick-and-dirty shortcut:
- I have Activestate Perl on my old laptop, with Image::Magick installed and working OK. So I hoped to copy it completely to my current laptop:
- I copied the whole tree c:\Perl64 and prepended its \bin to the
Path
variable. Nowperl --verion
successfully presents itself as ActiveState. However, it still looks for modules under c:\Strawbwerry not under c:\Perl64\lib, where Image::Magick is really present (copied from the old laptop). Is there an environment variable to control where pel will look for modules? Is there anything else that I should copy from my old laptop? I would prefer simple solutions, without compiling things locally. And without changing my Perl code itself Both systems (new - target and old - source) are Windows-10 Very strangely perl-V says: @INC: C:/Perl64/site/lib C:/Perl64/lib And still it does not find Image::Magick, which really is present in: C:\Perl64\site\lib\Image\Magick.pm Strangely, the error message says: Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC entries checked: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) Note that these @INC entries do not correspnd to to the value of @INC reported byperl -V
(see above) Interestingly, on the old (source) laptop,perl-V
reports the same as o the new (target) one: @INC: C:/Perl64/site/lib C:/Perl64/lib And there Image::Magick works OK, with the same tree od c:\Perl64 .
I can't install a Perl module. I have it installed and working OK on another laptop. Can I copy the whole installation from that laptop? What I tried:
- I have Strawberry on my current laptop. I tried to install Image::Magick, but it gives an error. I read that in principle it is possible to install Image::Magick to Strawberry from cpan , but it seems it's going to be quite complicated.
- I tried to install ActiveState Perl instead, but its installation procedure is too complicated. Plus, I would prefer to keep my Strawberry installation alongside with ActiveState for legacy programs. So I felt tempted to try a simpler quick-and-dirty shortcut:
- I have Activestate Perl on my old laptop, with Image::Magick installed and working OK. So I hoped to copy it completely to my current laptop:
- I copied the whole tree c:\Perl64 and prepended its \bin to the
Path
variable. Nowperl --verion
successfully presents itself as ActiveState. However, it still looks for modules under c:\Strawbwerry not under c:\Perl64\lib, where Image::Magick is really present (copied from the old laptop). Is there an environment variable to control where pel will look for modules? Is there anything else that I should copy from my old laptop? I would prefer simple solutions, without compiling things locally. And without changing my Perl code itself Both systems (new - target and old - source) are Windows-10 Very strangely perl-V says: @INC: C:/Perl64/site/lib C:/Perl64/lib And still it does not find Image::Magick, which really is present in: C:\Perl64\site\lib\Image\Magick.pm Strangely, the error message says: Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC entries checked: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) Note that these @INC entries do not correspnd to to the value of @INC reported byperl -V
(see above) Interestingly, on the old (source) laptop,perl-V
reports the same as o the new (target) one: @INC: C:/Perl64/site/lib C:/Perl64/lib And there Image::Magick works OK, with the same tree od c:\Perl64 .
- 2 Does this work? – Paul-ET Commented Jan 30 at 5:54
- The answer at the link posted by @Paul-ET looks just right -- I'm curious, did that resolve it? – zdim Commented Jan 30 at 19:10
- 1 My own take: I'd rather stick to Strawberry and resolve issues as they come up. – zdim Commented Jan 30 at 19:12
2 Answers
Reset to default 2Personally, I'd spend the extra time to install the Perl you want and the ImageImagick stuff you want. There's value in learning and smoothing the deployment. Consider what you are going to do next time this has to happen, such as when your computer dies, is stolen, or whatever. Maybe we can help figure out the ActiveState problem.
I think you need to unset the environment variables that Strawberry Perl was using to join to its library. In particular, you want to pay attention to PERL5LIB
and PERLLIB
. You don't want to share those across the perls compiled by different toolchains.
The error message, however, looks like you are running Strawberry Perl since @INC
doesn't have the ActiveState directories. You'll have to figure that out—probably by removing the perl you don't want to use.
The output of perl -V
should show you settings of any environment variables that start with PERL
.
Additionally, Perl modules compiled against external libraries may need parts of those and those parts may exist outside of the Perl directories. Not only that, those external libraries need to be a version compatible with the one the module was compiled against.
If your goal is just to run this Perl application on different systems, it's trivial to write a Dockerfile for the application, then spin a container from it to have it work regardless of the system, as long as they have Docker:
FROM perl:5.40
RUN cpan -I App::cpanminus
# You may need to install other libraries onto the container for Image::Magick
# but once you have it working once it should work forever.
RUN cpanm Image::Magick
COPY myscript.pl .
CMD ["perl", "myscript.pl"]
Now you can generate a container:
docker build -t mycontainer .
docker run -it mycontainer
Now you shouldn't have to worry about copying installations over, or any other hacks.
本文标签: windowsPerl Is it possible to copy a complete Perl installation to another computerStack Overflow
版权声明:本文标题:windows - Perl: Is it possible to copy a complete Perl installation to another computer? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741986261a2408697.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论