简体   繁体   English

Windows-在PATH“'”上找不到文件。 不在PATH中

[英]Windows - Can't find file on PATH, '.' not in PATH

I installed a package (Strawberry Perl) and added its bin directory ( C:\\Strawberry\\perl\\bin ) to the environment variables. 我安装了一个软件包(Strawberry Perl),并将其bin目录( C:\\ Strawberry \\ perl \\ bin )添加到环境变量中。 cpan is a package manager, its in there as cpan.bat . cpan是一个程序包管理器,在其中为cpan.bat

When I try to run it, heres what happens: 当我尝试运行它时,会发生以下情况:

C:\Users\horse> cpan -fi "DBD::mysql"
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH, '.' not in PATH.

Its obviously finding the file because how else would it know its exact location: C:\\Strawberry\\perl\\bin\\cpan.bat 它显然是在查找文件,因为它还会如何知道其确切位置: C:\\Strawberry\\perl\\bin\\cpan.bat

If I try running cpan.bat directory like this: 如果我尝试像这样运行cpan.bat目录:

C:\Users\horse> C:\Strawberry\perl\bin\cpan.bat  -fi "DBD::mysql"
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH, '.' not in PATH.

Same issue. 同样的问题。 I don't understand why it needs a '.' 我不明白为什么它需要一个“。” in the PATH, but I added it there to see what would happen, and its no longer saying anything about a '.' 在PATH中,但我在此处添加了它以查看会发生什么,并且它不再对“。”说什么。 but I'm still getting the same issue with it not finding cpan.bat: 但我仍然遇到同样的问题,找不到cpan.bat:

C:\Users\horse> cpan
Can't find C:\Strawberry\perl\bin\cpan.bat on PATH.

Does anyone know what the issue is here? 有人知道这里的问题吗?

The problem was I had two perl.exe files installed, when I ran get-command perl , it said its located in C:\\Program Files\\Git\\usr\\bin\\perl.exe . 问题是我安装了两个perl.exe文件,当我运行get-command perl ,它说它位于C:\\Program Files\\Git\\usr\\bin\\perl.exe So its using the version that came with with what looks like a CygWin install (C:\\Program Files\\Git\\usr\\bin\\ is loaded with unix like commands). 因此,它使用的是CygWin安装随附的版本(C:\\ Program Files \\ Git \\ usr \\ bin \\装有unix之类的命令)。 So I removed perl.exe from C:\\Program Files\\Git\\usr\\bin and it fixed the problem. 因此,我从C:\\Program Files\\Git\\usr\\bin删除了perl.exe ,它解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM