Windows 操作系统上的 ActivePerl 安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3051049/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ActivePerl Installation on Windows operating system
提问by Pavunkumar
I have installed ActivePerl on my Windows OS. I have followed below URL procedure to install
我已经在我的 Windows 操作系统上安装了 ActivePerl。我已按照以下 URL 程序进行安装
After having done that, I have tried to run "perl -v " on the command line. But it reports the following error.
完成后,我尝试在命令行上运行“perl -v”。但它报告以下错误。
The system cannot execute the specified program
系统无法执行指定的程序
What do I need to do to solve these issues?
我需要做什么来解决这些问题?
采纳答案by DVK
You need to make sure the directory where the Perl executable lives (it might be C:\perl\bin
, but basically wherever you told ActiveState Perl to be installed) is in your PATH environmental variable (you can find the variable value by typing set PATH
command on command line prompt in Windows).
您需要确保 Perl 可执行文件所在的目录(它可能是C:\perl\bin
,但基本上是您告诉 ActiveState Perl 安装的任何地方)在您的 PATH 环境变量中(您可以通过set PATH
在 Windows 的命令行提示符下键入命令来找到变量值)。
If you're not sure where you installed Perl to (and can't find it in the default C:\perl\bin
), you can find the directory by going to Start menu, finding ActiveState Perl folder, and right-clicking on "Perl Package Manager" icon, then pick "Properties" from the right-click menu. Properties window (in the "Shortcut" tab) will have a "Target" line showing the directory.
如果您不确定 Perl 的安装位置(并且在默认情况下找不到它C:\perl\bin
),您可以通过转到“开始”菜单,找到 ActiveState Perl 文件夹,然后右键单击“Perl 包管理器”图标来找到该目录,然后从右键单击菜单中选择“属性”。属性窗口(在“快捷方式”选项卡中)将有一个显示目录的“目标”行。
回答by sammy
I was facing a similar issue... but the thing was that I could execute the file by right clicking the file and opening it with perl command line interpreter.... but still the perl-v
command would give the error... all I had to do was execute this command
我遇到了类似的问题......但问题是我可以通过右键单击文件并使用perl命令行解释器打开它来执行文件......但该perl-v
命令仍然会给出错误......我所拥有的要做的是执行这个命令
set PATH=C:\Perl\bin;%PATH%
This solved the issue...
这解决了这个问题...
回答by Joenade
I was getting a similar error after installing ActiveState Perl on Windows 8 x64 bit edition and trying to invoke 'perl' at the command line.
在 Windows 8 x64 位版本上安装 ActiveState Perl 并尝试在命令行调用“perl”后,我遇到了类似的错误。
'perl' is not recognized as an internal or external command, operable program or batch file.
'perl' 不是内部或外部命令,也不是可运行的程序或批处理文件。
I remember selecting the option during installation to add the Perl directory to the system PATH environment, and after checking the system properties, it was indeed showing in the system PATH.
记得在安装的时候选择了将Perl目录添加到系统PATH环境中的选项,查看系统属性后,确实显示在系统PATH中。
I tried installing 'Microsoft Visual C++ 2008 x86 and x64 redistributable setup' files as suggested by a few places but it still did not resolve the issue, until I tried some of the suggestions in this thread.
我尝试按照一些地方的建议安装“Microsoft Visual C++ 2008 x86 和 x64 可再发行安装程序”文件,但它仍然没有解决问题,直到我尝试了此线程中的一些建议。
At the command prompt I entered:
在命令提示符下,我输入:
set PATH
And surprisingly it did not list the Perl directories as being included in the PATH variables.
令人惊讶的是,它没有将 Perl 目录列为包含在 PATH 变量中。
So to remedy that I entered this into the command prompt and hit enter:
为了解决这个问题,我将其输入到命令提示符中并按回车键:
set PATH=C:\Perl64\bin;C:\Perl64\site\bin;%PATH%
(The directory paths are for the 64 bit edition of Perl, adjust according to your installation) the %PATH% portion is important and ensures your existing settings are kept and not wiped out and overwritten when you set the PATH.
(目录路径适用于 64 位版本的 Perl,根据您的安装进行调整) %PATH% 部分很重要,可确保在设置 PATH 时保留现有设置,不会被清除和覆盖。
That fixed it and entering 'perl -v' into command prompt successfully replies your Perl version. If you had a PowerShell window open before setting the PATH variable, you will need to close it and re-open another instance of PowerShell.
修复它并在命令提示符中输入'perl -v'成功回复您的Perl版本。如果在设置 PATH 变量之前打开了 PowerShell 窗口,则需要关闭它并重新打开 PowerShell 的另一个实例。
I believe the original underlying issue was something to do with different PATH variables for 32-bit and 64-bit environments and possibly some internal Windows redirection that takes place automatically.
我相信最初的潜在问题与 32 位和 64 位环境的不同 PATH 变量有关,并且可能与一些自动发生的内部 Windows 重定向有关。
回答by justintime
This doesn't sound like a problem with PATH - I would expect it to give the message 'perl' is not recognized as an internal or external command, operable program or batch file.
这听起来不像是 PATH 的问题 - 我希望它给出信息 'perl' is not recognized as an internal or external command, operable program or batch file.
I have not seen this error message, but http://nirlevy.blogspot.com/2008/03/system-cannot-execute-specified-program.htmlmakes some suggestion for related programs. Or maybe ask on an Active State forum.
我还没有看到这个错误信息,但是http://nirlevy.blogspot.com/2008/03/system-cannot-execute-specified-program.html对相关程序提出了一些建议。或者在 Active State 论坛上提问。
回答by m77
I had a similar error which was solved by adding the .pl extension to the script name, which I had forgotten to do.
我有一个类似的错误,通过向脚本名称添加 .pl 扩展名解决了这个错误,我忘记了这样做。
I could not get it to work otherwise even with my Perl's location (C:\Apps\Perl\bin) verified as in %PATH%.
即使我的 Perl 位置 (C:\Apps\Perl\bin) 在 %PATH% 中验证,我也无法让它正常工作。
回答by Slawomir Domagala
I had the same error. I was able to solve it by changing the order of the Perl64 entries in the PATH variable in the Environment Variables. I moved the C:\Perl64\bin
to be before C:\Perl64\site\bin
and it worked.
我有同样的错误。我能够通过更改环境变量中 PATH 变量中 Perl64 条目的顺序来解决它。我把它移到了C:\Perl64\bin
之前C:\Perl64\site\bin
,它起作用了。
回答by dmarra
The problem lies in the installation directory.
问题出在安装目录上。
The Perl PATH variable will be set to C:\Program Files\perl (depends on 32 or 64 bit of course), BUT, the default installation directory is C:\perl. This is kind of sneaky actually as you would assume the installer would be more intelligent about this, but it sets the environment variable to that directory no matter WHERE you install the damned thing.
Perl PATH 变量将设置为 C:\Program Files\perl(当然取决于 32 或 64 位),但是,默认安装目录是 C:\perl。这实际上有点偷偷摸摸,因为您会认为安装程序对此会更智能,但是无论您在何处安装该死的东西,它都会将环境变量设置为该目录。