Python Forum
Attempting to run py2 and py3 on a windows box
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Attempting to run py2 and py3 on a windows box
#1
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.
Reply
#2
(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)
Reply
#3
(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?
Reply
#4
(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)
Reply
#5
Great thanks!
Reply
#6
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Attempting to read keyboard outside of console Jimmy998 5 1,350 Nov-25-2022, 08:17 PM
Last Post: Larz60+
Bug beginner attempting to make chatbot MonikaDreemur 1 1,106 Feb-02-2022, 10:24 PM
Last Post: BashBedlam
  Newbie to Python (Attempting to install DJango on a VPS) jarjar95 0 1,526 May-04-2021, 03:51 PM
Last Post: jarjar95
  List index out of range error when attempting to make a basic shift code djwilson0495 4 2,996 Aug-16-2020, 08:56 PM
Last Post: deanhystad
  Invalid archive error when attempting to install dash bootstrap components meaydemi 0 4,772 Jul-11-2019, 05:49 PM
Last Post: meaydemi
  attempting to run gimp-console from python in windows 10 matteusbeus 3 2,890 Oct-09-2018, 07:05 AM
Last Post: matteusbeus
  Attempting to port XTea Encryption from C to Python sonic1015 1 3,299 Jun-06-2017, 07:12 PM
Last Post: sonic1015
  Attempting to get pkg-config working Able98 0 3,117 Apr-02-2017, 03:51 PM
Last Post: Able98

Forum Jump:

User Panel Messages

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