Python Forum
python 3 and python 2 pips not working in windows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python 3 and python 2 pips not working in windows
#1
hello i installed python3 and want in windows that when i type python3 it calls python3 and just python it calls python 2 cause i installed cocos2dx framework which needs the default python to be python 2 i followed this guide https://medium.com/@ryanmillerc/install-...4287708429 but then when i type pip3 or pip i get the following error Fatal error in launcher: Unable to create process using ‘“c:\users\gustx\appdata\local\programs\python\python37\python.exe” “C:\Users\gustx\AppData\Local\Programs\Python\Python37\Scripts\pip3.exe”
pip
‘“c:\users\gustx\appdata\local\programs\python\python37\python.exe” “C:\Users\gustx\AppData\Local\Programs\Python\Python37\Scripts\pip.exe” anyone know how to fix this and make pip work again
Reply
#2
That's link is not the ideal way of doing this.
Just use py to access all other version installed.
Then there is no need to mess with or rename python.exe.
Explain all in here also usage of py Python 3.6/3.7 and pip installation under Windows

python and pip use the main most used version.
E:\div_code
λ python -V
Python 3.7.3

E:\div_code
λ pip -V
pip 19.2.1 from c:\python37\lib\site-packages\pip (python 3.7) 
Use other version.
E:\div_code
λ py -2.7 -V
Python 2.7.9

E:\div_code
λ py -3.4 -V
Python 3.4.2

E:\div_code
λ py -3.5 -V
Python 3.5.2

# Install to 2.7
E:\div_code
λ py -2.7 -m pip install requests
Requirement already satisfied: requests in c:\python27\lib\site-packages (2.18.4)
Reply
#3
If this is *your* machine, then do yourself a favor and install Python to C:\Python27 and C:\Python37. Pip is usually in the \pythonxx\scripts directory.

You need to add these to your path. Do this in Conjtrol Panel/System/look for Environment, and use system rather than user settings. C:\Python37;C:\Python37\scripts;C:\Python27;C:\Python27\scripts;

Do yourself a favor and copy Python37.exe to python3.exe and pip.exe to pip3.exe.
And do likewise with Python 2.7 . (Use pip2)

Then in your scripts, at the shebang use:
#!/env python3 for 3.7
#!/env python2 for 2.7

Pip is not a native part of python, and was bolted on much later....

It gets confusing because in many systems, including Debian here, pip will always default to Python 2.x

You can also try experimenting with symlinks to dirs already on your path, but I've run into problems with this on Anaconda.
Reply
#4
(Aug-17-2019, 05:03 PM)millpond Wrote: Do yourself a favor and copy Python37.exe to python3.exe and pip.exe to pip3.exe.
And do likewise with Python 2.7 . (Use pip2)

Then in your scripts, at the shebang use:
#!/env python3 for 3.7
#!/env python2 for 2.7
No this is just wrong,there is no Python37.exe in a Windows install only Python.exe.
As i mention you do not mess or rename anything at all,access to other version in Windows is bye using py.
If you not sure about this then don't give advice that can mess up stuff.
Reply
#5
(Aug-16-2019, 03:58 PM)snippsat Wrote: Just use py to access all other version[s] installed ...
Explain all in here also usage of py Python 3.6/3.7 and pip installation under Windows

This is a pretty poor answer for Windows users:
* install process for python 2 and python 3 affects the [path] environment differently and that is not demonstrated with an answer based on two python 3 versions
* the answer relies on a pretty esoteric piece of code, the Lambda function - something I don't understand or even know how to type, so it hasn't been communicated effectively to me

The issue of using pip with different python versions is common enough from an online search and doesn't seem to have a nice solution. It's something that should be covered in the python docs.

Hmm, maybe the λ (Lambda) is a font issue with the site or an unfortunate choice for a customised python prompt.

(I don't know why posts would be set so they can't be edited after 10 minutes.)

Seems to work but the second command is very slow, presumably because commands are not in the path

C:\Users\User>pip -V
pip 19.3.1 from c:\users\user\appdata\local\programs\python\python38\lib\site-packages\pip (python 3.8)

C:\Users\User>py -2 -m pip -V
pip 19.2.3 from C:\Python27\lib\site-packages\pip (python 2.7)

I think a better approach is to set up a separate environment for each version. My preference is not to add python to the path and just run a batch file to set up the environment for each version before use.
Reply
#6
https://python-forum.io/Thread-Part-2-Py...9#pid18249
Quote:A much better cmd cmder.

wtf - totally confusing with the λ etc, would be more clearly explained it in a vanilla environment
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question How to add Python folder in Windows Registry ? Touktouk 1 206 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE
  Python Launcher (on Windows) only necessary when 2 or more Python versions installed? pstein 1 265 Feb-17-2024, 12:43 PM
Last Post: deanhystad
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 319 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  working directory if using windows path-variable chitarup 2 680 Nov-28-2023, 11:36 PM
Last Post: chitarup
Question Need Help with Vehicle Routing Problem with Time Windows (VRPTW) in Python kasper321421312 1 506 Nov-10-2023, 08:19 PM
Last Post: snippsat
  How to find out from outside Python (in Windows) the current version of Python? pstein 4 680 Oct-04-2023, 10:01 AM
Last Post: snippsat
  C++ programmer confused about why Python isn't working the way I intend Radical 2 691 Sep-15-2023, 04:21 AM
Last Post: Radical
  New to Python - Not sure why this code isn't working - Any help appreciated TheGreatNinx 4 909 Jul-22-2023, 10:21 PM
Last Post: Pedroski55
  Python script running under windows over nssm.exe JaroslavZ 0 671 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  New to python/coding Need help on Understanding why this code isn't working. Thanks! mat3372 8 1,664 May-09-2023, 08:47 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020