1

I am getting an error similar to this when I try to execute any command in the terminal in vscode. Does anyone know how to solve this problem?

pip : The term 'pip' is not recognized as the name of a cmdlet, function, 
script file, or operable program. Check the spelling of the name, or if a 
path was included, verify that the path is correct and try again.
At line:1 char:1
+ pip install nba_api
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotF  
   oundException
    + FullyQualifiedErrorId : CommandNotFoundException
wjandrea
  • 16,334
  • 5
  • 30
  • 53
anonymous
  • 11
  • 2
  • 1
    This is usually the issue with your system `PATH`. Try [this answer](https://stackoverflow.com/a/23709194/1509809) – thuyein Dec 25 '19 at 02:44

1 Answers1

0

You have to include the path of pip to your PATH environment variable. Powershell or Cmd cannot automatically understand paths. Without enlisting the directory in PATH environment variable, you have to include the full path of the pip command. So you have to use this:

cmd /c "setx.exe PATH %PATH%;ThePathOfPip"

After running this close all instances of powershell and changes will be notable after the next session.

This will also work:

$env:path = $env:path + ";" + "The path of pip"

But it will only save the value for current session and so I don't recommend it.

Wrote this answer using a little from the comment provided link and combining my own knowledge.

programmer365
  • 12,641
  • 3
  • 7
  • 28