0
votes

I just installed Python and VScode yesterday. I was trying to use pip to install updates but the command python doesn't work. However py does. I'm wondering why this is and if there's a way to make the command python recognized.

In addition, I was wondering if there was a quicker way to run the terminal/shortcut alternative to right-clicking then selecting Run Python File in Terminal.

Lastly, I wanted to understand if I messed up during installation, because when I ran setx PATH "%PATH%;C:\Python34\Scripts" then echo %PATH%, instead of a seeing C:\Python34\Scripts I see a huge block of paths like:

C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\yiyan\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\yiyan\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\W

Thank you for your time!

3

3 Answers

0
votes

Your path output is limited by lenght - your path is way longer and cut at C:\W - google how to inspect your path using windows methods: edit path and check it.

You should cleanup your path variable - it is way too long and has duplicates in it:

t = r"""C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\yiyan\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\yiyan\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\ProgramData\Oracle\Java\javapath;C:\W"""

from collections import Counter    
print (Counter(t.split(";")))

Output:

Counter(
    {'C:\\WINDOWS\\system32': 4, 
     'C:\\WINDOWS': 4, 
     'C:\\WINDOWS\\System32\\Wbem': 4,
     'C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\': 4,
     'C:\\Program Files (x86)\\Razer\\ChromaBroadcast\\bin': 3,
     'C:\\Program Files\\Razer\\ChromaBroadcast\\bin': 3,
     'C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath': 3,
     'C:\\Program Files (x86)\\Razer Chroma SDK\\bin': 3,
     'C:\\Program Files\\Razer Chroma SDK\\bin': 3,
     'C:\\ProgramData\\Oracle\\Java\\javapath': 3,
     'C:\\Windows\\system32': 2,
     'C:\\Windows': 2,
     'C:\\Windows\\System32\\Wbem': 2,
     'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\': 2,
     'C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common': 2,
     'C:\\Users\\yiyan\\AppData\\Local\\Microsoft\\WindowsApps': 2,
     'C:\\WINDOWS\\System32\\OpenSSH\\': 2,
     'C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR': 2,
     'C:\\W': 1})

The %path is used to lookup a file if it does not exist inside your current directory (simplified) - having the same directory in it multiple times makes no sense whatsoever.

If a executeable would be in a dir - it would have beed found using the first entry in your %path - no need to look again 6 folders later.

After cleaning up your dupes, add the python folder to your path.

0
votes

I think the console command being 'py' and not 'python' anymore is post Python 3.8. I had Python 3.7 up until a few days ago and got confused when I updated too.

-1
votes

typ this in cmd:

copy py.exe python.exe

in the map:

C:\Windows\system32

to go to there typ:

cd C:\Windows\system32

in cmd