Windows - 无法在PATH上找到文件,'。'不在PATH

时间:2016-11-14 00:58:39

标签: windows perl

我安装了一个包(Strawberry Perl)并将其bin目录( C:\ Strawberry \ perl \ bin )添加到环境变量中。 cpan是一个包管理器,它位于cpan.bat

当我尝试运行它时,会发生什么:

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

它显然找到了该文件,因为它还知道它的确切位置:C:\Strawberry\perl\bin\cpan.bat

如果我尝试像这样运行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.

同样的问题。我不明白为什么它需要一个''在路径中,但我在那里添加了它,看看会发生什么,它不再说任何关于'。'但我仍然遇到同样的问题,因为没找到cpan.bat:

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

有谁知道这里的问题是什么?

1 个答案:

答案 0 :(得分:8)

问题是我安装了两个perl.exe文件,当我运行-- CREATE TABLES CREATE TABLE friends ( `friendid` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `first_name` TEXT, last_name TEXT, `work` TEXT, `education` TEXT, `current_city` TEXT, `phone_number` TEXT, `dob` TEXT, `gender` TEXT, `sexual_orientation` TEXT, `religion` TEXT, `relationship_status` TEXT, `about_me` TEXT); CREATE TABLE workplaces ( `workplaceid` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `friendid` INTEGER, `workplace` TEXT NOT NULL, `city` TEXT, `state` TEXT); CREATE TABLE posts ( `postid` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `friendid` INTEGER, `text` TEXT NOT NULL, `postdate` TEXT, `postlocation` TEXT); -- POPULATE TABLES (adjust to actual tables/fields) INSERT INTO friends (first_name, last_name) SELECT SUBSTR(`name`, 1, INSTR(`name`, " ")) AS first_name, SUBSTR(`name`, INSTR(`name`, " ")+1) AS last_name, FROM fb_friends; INSERT INTO workplaces (friendid, work, city) SELECT f.friendid, w.work, w.city FROM fb_work w INNER JOIN friends f ON w.name = f.first_name & ' ' & f.last_name; INSERT INTO posts (friendid, `text`, postdate) SELECT f.friendid, p.post_text, p.post_date FROM fb_posts p INNER JOIN friends f ON p.name = f.first_name & ' ' & f.last_name; 时,它说它位于get-command perl。所以它使用附带的版本看起来像CygWin安装(C:\ Program Files \ Git \ usr \ bin \加载unix like命令)。所以我从C:\Program Files\Git\usr\bin\perl.exe删除了perl.exe,它解决了问题。