4

我在64位PC上使用Windows 10。最近,我開始在Windows上使用VS Bash和Ubuntu Bash。除了掉毛之外,一切都很好。我試圖讓它與pylint和pep8一起工作,但沒有一個能夠工作。我認爲問題是由於棉絨的位置造成的。但是,我無法弄清楚如何解決這個問題。您可以檢查我的設置爲pylint:Visual Studio代碼,與WSL的Python LINT(用於Linux的Windows子系統)

// Whether to lint Python files using pylint. 
"python.linting.pylintEnabled": true, 

// Severity of Pylint message type 'Convention/C'. 
"python.linting.pylintCategorySeverity.convention": "Information", 

// Severity of Pylint message type 'Refactor/R'. 
"python.linting.pylintCategorySeverity.refactor": "Hint", 

// Severity of Pylint message type 'Warning/W'. 
"python.linting.pylintCategorySeverity.warning": "Warning", 

// Severity of Pylint message type 'Error/E'. 
"python.linting.pylintCategorySeverity.error": "Error", 

// Severity of Pylint message type 'Fatal/F'. 
"python.linting.pylintCategorySeverity.fatal": "Error", 

// Path to Pylint, you can use a custom version of pylint by modifying this 
// setting to include the full path. 
"python.linting.pylintPath": "pylint", 

// Arguments passed in. Each argument is a separate item in the array. 
"python.linting.pylintArgs": [], 

我將不勝感激任何幫助。謝謝你...

+0

「Bash on Windows」a.k.a WSL是一個命令行環境。在其中使用GUI編輯器(VS代碼)有什麼意義?無論如何,主機Windows和「bash」容器共享的文件夾路徑以/ mnt/c(或其他驅動器號)開頭,是的,您需要在Windows和bash端使用不同的路徑。 RTFM。 – ddbug

+0

@ddbug感謝您的評論。 VS Code是任何編程語言的代碼編輯器。我使用bash通過編輯器編譯代碼。但是,linter已經安裝在bash中。因此,我不需要/ mnt/c在Windows中訪問我的文檔。我嘗試過「C:\\ Users \\ user \\ AppData \\ Local \\ lxss \ rootfs \\ usr \ bin \\ pylint」,但這並沒有奏效。 –

回答

4

從我所知道的,如果你使用WSL,shell是一個獨立於VSCode的環境。這就是爲什麼git擴展won't work,除非你安裝Windows版本,即使你已經安裝在WSL中。雖然有可能invoke WSL from Windows,但我一直無法使它工作。

因此,對於linting,在Windows中安裝Python和flake8(例如,在Git Bash中安裝flake8),你應該沒問題。

P.S.如果有人能告訴我,否則,我很想知道!實際上不得不下載兩次東西(一次是在Windows中,一次是在WSL中)。

相關問題