VSCode:在所选环境中没有可用的Pip安装程序 [英] VSCode: There is no Pip installer available in the selected environment
问题描述
我正在尝试在VSCode中的Python文件上运行autopep8 linter.
I'm trying to run the autopep8 linter on a Python file in VSCode.
我已按照此处的说明进行操作: https://code.visualstudio.com/docs/python/environments 并选择了我的解释器(⇧⌘P):/usr/local/bin/python
I've followed the instructions here: https://code.visualstudio.com/docs/python/environments and selected my interpreter (⇧⌘P): /usr/local/bin/python
然后我尝试格式化我的代码,VSCode表示未安装autopep8,可以通过Pip进行安装.但是,当我尝试通过Pip安装时,显示为There is no Pip installer available in the selected environment
.
I then try to format my code, and VSCode says autopep8 isn't installed, and can be installed via Pip. However, when I try to install via Pip, it says There is no Pip installer available in the selected environment
.
然后我尝试通过在命令面板中选择 Python:创建终端,在当前环境中启动终端.
I then tried launching a terminal in the current environment by selecting Python: Create Terminal from the Command Palette.
终端可以正常打开,pip
存在,我什至可以在VSCode中打开的终端中pip install autopep8
,但是当我尝试运行 Format Document 命令时,我得到了与autopep8
和pip
相同的错误在环境中不可用.
The terminal opens fine, pip
is present, and I'm even able to pip install autopep8
in the terminal that opened in VSCode, but when I try running the Format Document command I get the same errors that autopep8
and pip
aren't available in the environment.
推荐答案
在Ubuntu16.04上,我在vscode中使用了Python3,并且
On Ubuntu16.04, I worked with Python3 in vscode and
apt-get install python3-pip
解决了我的问题.
那是因为我发现:在终端下,键入pip -V
.它显示它适用于Python2,而不适用于Python3.
That's because I discover that: Under my terminal, I type the pip -V
. It displays it's for Python2, not for Python3.
这篇关于VSCode:在所选环境中没有可用的Pip安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!