2

I have an Amazon EC2 instance. On that was just python 2.7 installed. So I installed Python3 with the command "sudo yum install python34".

Then I tried to install modules with "pip install package". The terminal told me, that I can upgrade pip. So i upgraded pip. No my instance either find the command pip or pip3.

I googled and find that I have to use "python -m pip install SomePackage" I installed a module and tried to start one of my scripts with "python3 script.py"

I got the information that my module still isn't installed. I tried to install it again. It showed me that my module is already installed but in the python2.7 folder.

So what is the right command to use pip with python3.4 instead of python2.7?

With all the following commands, I get the information that there is no module named pip or pip3:

  • "python3 -m pip install package"
  • "python34 -m pip install package"
  • "python3 -m pip3 install package"
  • "python3.4 -m pip install package"
  • "pip install package"
  • "pip3 install package" (Package already installed in python2.7)
  • "pip3.4 install package"
TomHere
  • 469
  • 1
  • 7
  • 13
  • I still get the message "Requirement already up-to-date: pip in /path/python2.7/site-packages" Don't know why it points to 2.7 instead of 3.4 – TomHere May 27 '16 at 09:05
  • what do your environment variables say? how is python3 referenced there? – glls May 27 '16 at 09:06
  • @glls what do you mean? Sorry, I am new to python – TomHere May 27 '16 at 09:07
  • https://docs.python.org/3.4/using/windows.html – glls May 27 '16 at 09:09
  • @SuperBiasedMan already checked out. Find no answer in where. Because there everything works normal. By me I have trouble because pip3 installs still pip – TomHere May 27 '16 at 09:12
  • @TomHere Sorry yeah I missed your last attempt. Not sure if this will help but did you look at this answer specifically: http://stackoverflow.com/a/2812627/4374739 – SuperBiasedMan May 27 '16 at 09:13
  • @SuperBiasedManhow do I found out there pip3 is installed? in /usr/bin I can just find pip, not pip3. If I want to use pip it calls me that the distribution pip==6.1.1 is not found (because I updated to 8.1.2) – TomHere May 27 '16 at 09:35
  • Have it. Uninstalled pip and installed it new. Now it works. – TomHere May 27 '16 at 09:54

2 Answers2

1

You can force package install for python3 by:

[sudo] python3 -m pip install [package]
Sergii Shcherbak
  • 837
  • 1
  • 11
  • 12
0
  1. try # pip install --upgrade pip. this would upgrade pip8.1.1(for python2.7) to 8.1.2(for python3) or
  2. try this https://bootstrap.pypa.io/get-pip.py, it would install pip2 and pip3 as well as setup properly, so this is recommended.