1

I'm working with fresh installations of VSCode and Python 3.11. the commands python and pip are both recognized in the Window's powershell and command prompts. However, when I swap to VSCode, neither command is recognized in either terminal.

VScode is obviously finding my python installations. I can select from my various python interpreters if I open the command pallette with ctrl+shft+p and go to Python: Select Interpreter. I can see my Python 3.11 installation, as well as my conda environments from ArcGIS Pro.

I've checked my PATH variables and using the Windows Powershell I see a whole list of directories, but only one when I check in VS Code Powershell (I see a path to 'C:\Program Files\ArcGIS\Pro\bin\Python\Scripts).

QUESTION: why does neither the VSCode PowerShell terminal nor the CMD terminal recognize the pip or python commands? How do I fix this?

4
  • When you installed Python, did you check the "Add Python to your env" option? If not, you have to add the Python executables to your PATH manually. For why it works in PowerShell: Are you sure it's Python? PowerShell presents you a fake python.exe until you really install Python. Try python --version in PowerShell. Commented Apr 27, 2023 at 15:57
  • @stackprotector, yes I did have that option checked. python --version in the Windows powershell returns Python 3.11.3 which is the correct version Commented Apr 27, 2023 at 16:10
  • Then you probably just need to close the VSCode terminals (recycle bin icon, not the "X") and reopen them so that they reload environment variables. Commented Apr 27, 2023 at 16:13
  • 1
    @stackprotector . That's what I would have thought as well but it doesn't fix it. However, it has maybe given another clue. If I open a new terminal after killing the old one, hovering over the powershell icon give me a process id, a command line string, and Shell integration failed to activate . So that would tell me that the VSCode powershell isn't talking to the Window's powershell at all Commented Apr 27, 2023 at 16:53

1 Answer 1

1

You can open your Settings and search for terminal.integrated.shell.window.

You can check whether it displays an absolute path in the drop-down list to check if it really found the shell location.

You can also set the path in user settings.json as the following picture:

enter image description here

If this doesn't help, follow this document about troubleshooting steps to diagnose issues.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.