2012-07-13 122 views
2

我是一名真正的初學者,學習如何使用Zed Shaw的「Python學習困難方式」來使用Python。到目前爲止,只要我以完全相同的方式輸入,我沒有任何代碼給出錯誤,但在練習46中,我無法設置我的skelton項目。在這本書中,它說,鍵入:學習Python難題練習46:mkdir bin NAME測試文檔

$ mkdir -p projects<br/> 
$ cd projects/<br/> 
$ mkdir skeleton<br/> 
$ cd skeleton<br/> 
$ mkdir bin NAME tests docs<br/> 

I have already checked this Learn Python the Hard Way: Exercise 46 but I could not do the last line "mkdir bin NAME tests docs". It (I am using Windows PowerShell) gives me an error saying:

"mkdir : A positional parameter cannot be found that accepts argument 'Name'.<br/> 
At line:1 char:6<br/> 
+ mkdir <<<< bin NAME tests docs<br/> 
    + CategoryInfo   : InvalidArgument: (:) [mkdir], ParameterBindingException<br/> 
    + FullyQualifiedErrorID : PositionalParamaterNotFound,mkdir<br/> 

Could anybody please tell me what is going on and how I can fix this? I am sorry this is really a basic question but is "$ mkdir bin NAME tests docs" trying to make multiple directories named "bin", "NAME", "tests", and "docs"?

+1

你輸入 「$的mkdir倉位名稱測試文檔」 或「MKDIR倉位名稱測試文檔「? – Jerome 2012-07-13 20:06:55

+1

@Jerome:'$'是一個常用的命令提示符號,最後我檢查了一下,所以後者更可能。特別是後來的問題表明該行嘗試的是「mkdir bin NAME tests docs」。 – JAB 2012-07-13 20:09:08

+0

感謝您的快速響應!不,我明白我不應該輸入$(> for Windows)。 – owl 2012-07-13 20:11:46

回答

6

You can just as easily do mkdir bin,NAME,tests,docs

+0

謝謝!這對Po​​werShell有效。因此,在PowerShell中,您需要在要創建的新目錄之間使用逗號! – owl 2012-07-13 20:17:38

+0

或者如果你可以欺騙shell以爲它是一個使用'mkdir ./ {bin,Name,tests,docs}的命令參數' – 2012-07-13 20:20:09

+0

給了我上面寫的同樣的錯誤...但是你告訴我的上面的那個工作正常!非常感謝你,這樣快速的迴應! – owl 2012-07-13 20:22:02

1

Use the normal Windows command-line. It works fine there. (Well, on Windows XP, at least. Don't see why it would be different for Vista or 7, though.)

(Though as others have pointed out, you could still use Windows Powershell if you just separate the directories to make with commas.)

+0

也適用於Windows 7。 – 2012-07-13 20:09:34

+0

謝謝,我只是嘗試了正常的Windows命令行,它確實在那裏工作。它做了我以爲會這樣做,而不是PowerShell,這是我一直在使用這些練習。 – owl 2012-07-13 20:15:56

0

我覺得應該是

mkdir bin\<Project Name>\tests\docs\

+0

完全不符合所需的目錄佈局。 – JAB 2012-07-13 20:14:43

+0

在PowerShell上再次給我一個錯誤... – owl 2012-07-13 20:18:21

+0

@owl有趣的是,雖然這個實際上並沒有做你想做的事,但它在'cmd.exe'中也沒有錯誤。我想知道爲什麼PowerShell設計人員決定以這種方式與vanilla命令行參數樣式不兼容。 – JAB 2012-07-13 20:20:56