Python Forum
Attempting to run py2 and py3 on a windows box - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Attempting to run py2 and py3 on a windows box (/thread-11175.html)



Attempting to run py2 and py3 on a windows box - Vysero - Jun-26-2018

I already have py3 installed on my windows box and I recently downloaded py2. For some reason I figured it would be as easy as specifying in the command line which version of python to run. So I tried typing py -2 and it says Python 2 not found! Cry So, whats the trick here? I have py2 and 3 on my linux box but I downloaded them in opposite order and I didn't have to change any pathing there so I am wondering if I should uninstall and reinstall in the opposite order or something like that.


RE: Attempting to run py2 and py3 on a windows box - snippsat - Jun-26-2018

(Jun-26-2018, 04:01 PM)Vysero Wrote: typing py -2
You most also specify version.
E:\1
λ py -2.7 -V
Python 2.7.9

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

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

E:\1
# Install to 2.7
λ py -2.7 -m pip install logzero
Collecting logzero
  Downloading https://files.pythonhosted.org/packages/97/24/27295d318ea8976b12cf9cc51d82e7c7129220f6a3cc9e3443df3be8afdb/logzero-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from logzero)
Installing collected packages: logzero
Successfully installed logzero-1.5.0

# Main version <python> and <pip> point to 3.6
E:\1
λ python -V
Python 3.6.4

E:\1
λ pip -V
pip 10.0.1 from c:\python36\lib\site-packages\pip (python 3.6)



RE: Attempting to run py2 and py3 on a windows box - Vysero - Jun-26-2018

(Jun-26-2018, 04:57 PM)snippsat Wrote:
(Jun-26-2018, 04:01 PM)Vysero Wrote: typing py -2
You most also specify version.
E:\1
λ py -2.7 -V
Python 2.7.9

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

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

E:\1
# Install to 2.7
λ py -2.7 -m pip install logzero
Collecting logzero
  Downloading https://files.pythonhosted.org/packages/97/24/27295d318ea8976b12cf9cc51d82e7c7129220f6a3cc9e3443df3be8afdb/logzero-1.5.0-py2.py3-none-any.whl
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from logzero)
Installing collected packages: logzero
Successfully installed logzero-1.5.0

# Main version <python> and <pip> point to 3.6
E:\1
λ python -V
Python 3.6.4

E:\1
λ pip -V
pip 10.0.1 from c:\python36\lib\site-packages\pip (python 3.6)

Great thanks! Another question, if you don't mind. Running python -m pip --version it says: No module named pip which seems odd because python3 -m pip --version shows pip 10.0.1 I guess I was under the assumption that python2 would come with pip installed, was this an incorrect assumption or do I have some kind of conflict?

Python 2.7.15 is my version btw

EDIT: turns out no, in my python27:Scripts folder there is no pip while in my python37:Scripts folder I have pip, pip3.7 and pip3. Which of these can I delete and which one do I want in my python27:Scripts folder? Can I copy and paste?


RE: Attempting to run py2 and py3 on a windows box - nilamo - Jun-26-2018

(Jun-26-2018, 05:47 PM)Vysero Wrote: EDIT: turns out no, in my python27:Scripts folder there is no pip while in my python37:Scripts folder I have pip, pip3.7 and pip3. Which of these can I delete and which one do I want in my python27:Scripts folder? Can I copy and paste?

Python2 and Python3 are different languages. If you copy pip3 and paste it into python2's Script's directory, you shouldn't expect it to actually work. If you want to install it, you could run the ensurepip module, which will install pip if it's not already installed: python2.7 -m ensurepip (or, however you invoke your python2 interpreter)


RE: Attempting to run py2 and py3 on a windows box - Vysero - Jun-26-2018

Great thanks!


RE: Attempting to run py2 and py3 on a windows box - snippsat - Jun-26-2018

(Jun-26-2018, 05:47 PM)Vysero Wrote: I was under the assumption that python2 would come with pip installed
Which of these can I delete and which one do I want in my python27:Scripts folder?
You shall not delete anything,all version from 2.7.9 --> comes with pip.
You may have unmarked(v) pip under installation of 2.7.15,then as @nilamo posted ensurepip.