VSCode:所選環境中沒有可用的Pip安裝程序
我正在嘗試在VSCode中的Python文件上運行autopep8 linter .
我按照這里的說明操作:https://code.visualstudio.com/docs/python/environments並選擇了我的口譯員(⇧⌘P): /usr/local/bin/python
然后我嘗試格式化我的代碼,VSCode說沒有安裝autopep8,可以通過Pip安裝 . 但是,當我嘗試通過Pip安裝時,它會說 There is no Pip installer available in the selected environment
.
然后,我嘗試從命令選項板中選擇 Python: Create Terminal ,在當前環境中啟動終端 .
終端打開正常, pip
存在,我甚至能夠在VSCode中打開的終端 pip install autopep8
,但是當我嘗試運行 Format Document 命令時,我得到的錯誤是 autopep8
和 pip
在環境中不可用 .
2 years ago
在Ubuntu16.04上,我在vscode中使用Python3
解決了我的問題 .
那是因為我發現:在我的終端下,我鍵入
pip -V
. 它顯示的是Python2,而不是Python3 .