2

As I have started to use Python 3.4, I need pip to maintain libraries on both Python 2.7 and Python 3.4.

How to select the appropriate pip quickly using terminal?

Note: This question is NOT related to Virtualenv but with the default python2.7 and python3.4 that comes with Fedora 22 Workstation.

As a temporary fix, I am using PyCharm to manage libraries.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
Rk..
  • 753
  • 1
  • 10
  • 27
  • Don't you have `pip` for 2.7 and `pip3` for 3.4? – jonrsharpe Jul 02 '15 at 10:55
  • I get same results when I use pip and pip3. [root@localhost ~]# pip -V `pip 7.1.0 from /usr/lib/python3.4/site-packages (python 3.4)` [root@localhost ~]# pip3 -V `pip 7.1.0 from /usr/lib/python3.4/site-packages (python 3.4)` – Rk.. Jul 02 '15 at 11:07
  • Have you tried e.g. http://stackoverflow.com/q/2812520/3001761? – jonrsharpe Jul 02 '15 at 11:11

4 Answers4

3

I never use pip install directly (when outside a venv, at least).

Instead I use python-<version> -m pip install --user <packages>, which always does what I really meant regardless of what version the wrapper scripts are for. This is especially useful if I've locally installed a newer version of pip.

o11c
  • 15,265
  • 4
  • 50
  • 75
2

Fedora separates Python 2.x and 3.x's environments. yum install python-pip will give you an executable called pip which you can use for Python 2.x packages, and yum install python3-pip will give you an executable called pip3for managing Python 3.x packages.

You can install either, both or neither - they will not interfere with each other.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
2

I'm using Fedora 23 and I have the package python3-pip already installed but there's no pip3 nor python3-pip command in my path, so the way I've found to use pip3 is to invoke it through python3 executable:

python3 -mpip

For example, to install mps-youtube:

sudo python3 -mpip install mps-youtube
Anler
  • 1,793
  • 13
  • 21
0

on fedora 25 you can just do the following:

  • copy file sudo cp /usr/bin/pip /usr/bin/pip3
  • then edit it to change #!/usr/bin/python to #!/usr/bin/python3
  • do pip3 -V to see that works.

this solution can also work on others version of fedora.