18

I have python 3.6 installed, I have a python extension installed on Visual Studio code but I still can't use pip on Visual Studio code. It says it is not a recognised command. Any help please?

Update: I tried installing pip manually but a file in python2.7 keeps stopping. What's bothersome is that I uninstalled python 2.7 ages ago and I've currently removed every folder with it but python-V still says I have python2.7.6 installed.

I'm on windows 10

Drew U
  • 443
  • 2
  • 8
  • 17
  • You dont specify which OS you are on, but if you are on Windows, see what the Path values for Python is . If it points to Python 2.7 location , please replace it with the folder that points to your current installation.. – Gagan Feb 26 '17 at 02:42
  • Here is a SO link that might help you , if you are on windows : http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7 – Gagan Feb 26 '17 at 02:46
  • I already checked the path, there isn't anything with python is it. Is that a problem? Also I'm on windows sorry, I'll specify it now – Drew U Feb 26 '17 at 02:54
  • I am pretty sure if you add your ( Python 3.6 installation ) location to the system path it should be resolved. – Gagan Feb 26 '17 at 02:56
  • @Gagan okay, I'll do that now. Thank you – Drew U Feb 26 '17 at 03:00
  • You might want to restart VS code after having changed the path. – Gagan Feb 26 '17 at 03:01
  • So I changed the path and now VS Code is using python3.6 which is great but it still doesn't recognise pip as a command and my Bash Shell is still using the python 2.7.6 version – Drew U Feb 26 '17 at 03:22
  • have you tried running pip from outside of vscocde using 3.6 ? – Gagan Feb 26 '17 at 03:24
  • I was going to use my bash shell but it's still using the uninstalled version of python2.6.7. – Drew U Feb 26 '17 at 03:25
  • Okay. I got the VScode to use pip by adding the pip path to PATH. I'll fix the bash shell later I guess. Thank you for the help – Drew U Feb 26 '17 at 03:26
  • If i create a new answer , would you be kind enough to accept that as an answer .. it would be helpful ! - thanks – Gagan Feb 26 '17 at 03:29
  • Thanks :) .. much appreciated! – Gagan Feb 26 '17 at 04:28

2 Answers2

10

I found some solution on this website:

https://pip.pypa.io/en/stable/installing/

If you use Visual Studio Code, you can type the following command:

   C:\> py -m pip

If everything is alright, you should see the list of commands, which you can use. They are listed in your terminal, as per below.

enter image description here

I also would advise you to check/select the version of Python you are using:

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

Geographos
  • 827
  • 2
  • 23
  • 57
  • I got a "C:\ : The term 'C:\' 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." error running this command – Some Guy Sep 12 '22 at 20:03
  • Make sure that your path is written correctly. It's good to copy a sample path from another Python console and change the directory. Your comment states, that the path hasn't been written correctly. It might be even one letter wrong and the following error will appear. – Geographos Sep 13 '22 at 08:33
  • I copied the command from your answer directly – Some Guy Sep 13 '22 at 18:14
  • Have you installed the Python plugin for VSC? – Geographos Sep 14 '22 at 14:47
  • Of course, I need to install a package for a python project but pip install isn't working – Some Guy Sep 14 '22 at 21:09
  • I'm an idiot, I got it. I put down "C:\> py" instead of putting down C:\ then the path to my python – Some Guy Dec 16 '22 at 20:12
  • @SomeGuy don't call yourself this way! You wouldn't want to know how many silly mistakes I did. We are learning and getting better every day! Glad, that I could help you :) – Geographos Dec 19 '22 at 09:41
4

I am pretty sure your problems of VSCode not finding the correct version of Python will be resolved if you add your ( Python 3.6 installation ) location to the system path.

Gagan
  • 5,416
  • 13
  • 58
  • 86