Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode: There is no Pip installer available in the selected environment

I'm trying to run the autopep8 linter on a Python file in VSCode.

I've followed the instructions here: https://code.visualstudio.com/docs/python/environments and selected my interpreter (⇧⌘P): /usr/local/bin/python

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.

I then tried launching a terminal in the current environment by selecting Python: Create Terminal from the Command Palette.

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.

like image 224
ashgromnies Avatar asked Jun 22 '18 18:06

ashgromnies


People also ask

How do I fix pip is not recognized in Visual Studio code?

In the Environment Variables screen, go to System variables and click on Path to select it. Then with the Path selected, click the Edit… button. In the Edit environment variable screen, click on New and add the path where the PiP installation is located.

How do I enable pip in Visual Studio?

Select the Run command: pip install matplotlib option. This option installs matplotlib , and any packages it depends on (in this case, that includes numpy ). Consent to elevation if prompted to do so. After the package installs, it appears in the Python Environments window.


2 Answers

On Ubuntu16.04, I worked with Python3 in vscode and

apt-get install python3-pip 

solves my problem.

That's because I discover that: Under my terminal, I type the pip -V. It displays it's for Python2, not for Python3.

like image 76
sean.wu Avatar answered Sep 20 '22 19:09

sean.wu


Man you can only change the interpreter.

Go in (ctrl + shift + p), then type Python: Select Interpreter, this way you choose the version that your extension needs.

This worked for me.

like image 23
elan lima Avatar answered Sep 20 '22 19:09

elan lima