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
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)
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.
(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.
(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.