Reputation: 16145
I've got a python project for which I'm using VS Code on Windows. I created a virtual environment (py -3 -m venv .venv
). This all seems to be fine. When I activate (.\.venv\Scripts\Activate.ps1
or .\.venv\Scripts\activate.bat
) I see (.venv)
. I can run pip
in the activated environment or not. However, when I open a .py
file there is a warning that there is no linter installed. I click install and then I get this:
I've tried creating the virtual env different ways. I've tried this answer. No matter what I do I always get that error message. Any ideas would be great.
Upvotes: 5
Views: 11351
Reputation: 663
I've experienced the same issue. While I don't know what causes it, I've
found that creating the virtual environment using the Windows command prompt (using e.g. py -3 -m venv .venv
) rather than via a terminal in VS Code successfully creates an environment that includes pip
- then I can return to VS Code and work with it without issue.
Upvotes: 1
Reputation: 186
From VSCode: There is no Pip installer available in the selected environment
I have multiple python versions:
- 2.7
- 3.6
- 3.7
Tell the vscode/ visual studio code, which version to use: press the following (Show All Commands):
Ctrl + Shift + P
paste the following: Python: Select Interpreter Select one of the version that it shows, I have selected python 3.7.3 64-bitUpdate python path in settings: press
Ctrl +
, to open Settings search for python.pythonPath change python to /usr/bin/python3.7
Note: For windows you will need to find your python path. Mine was C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64
I had pip but it was 2.7, but since I am choosing python 3, it's pip needs to be installed Run the following command in Terminal:
apt-get install python3-pip
I didn't have to install python pip as it was already installed.
Restart vscode With the above steps, all issues got resolved. Hope that helps.
Upvotes: 2
Reputation: 16145
Wow after about 3 hours of banging my head I found the answer here: http://timmyreilly.azurewebsites.net/python-pip-virtualenv-installation-on-windows/
Using that guide instead of the official vs code docs (where I got the py -3 -m venv
command), VS Code was able to work properly.
Upvotes: 4