Reputation: 2473
I've installed Lubuntu 16.04 LTS that comes with Python 3.5, but with Python 2.7 as default Python interpreter.
Both versions comes without pip
package intalled. I only will use the 3.5 version. So I've installed pip3
with:
$ sudo apt-get install python3-pip
Then I tried to update the pip
version (because the Ubuntu repositories have old versions):
$ pip3 install --upgrade pip3
But pip3
can't locate pip3
package, and sends me this message:
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: ) No matching distribution found for pip3
After that, I tried this other:
$ pip3 intall --upgrade pip
And it updates from pip 8.1.1 to pip 8.1.2
pip 8.1.2 from /home/trimax/.local/lib/python3.5/site-packages (python 3.5)
If I try this:
$ pip -V
Doesn't work:
The program 'pip' is currently not installed. You can install it by typing: sudo apt-get install python-pip
But if I try this:
$ python3 -m pip -V
That works:
pip 8.1.2 from /home/trimax/.local/lib/python3.5/site-packages (python 3.5)
The question is Why runs pip
as module but not as script?
Upvotes: 0
Views: 366
Reputation: 98
PEP 394 describes naming of Python binaries, and according to its recommendations, you have pip3
in system because pip
is reserved for Python 2.x pip.
Of course you can alias pip
to pip3
, but it's not recommended.
Upvotes: 0
Reputation: 347
pip3 is in reality the pip package for python3. Since both python2 and python3 can coexist, the pip package for 3.5 is renamed as pip3 to avoid conflict. (By the package manager).
The upgrade syntax for any package is
<script_name_for_pip> install --upgrade <package_name>
and the package name is pip in pipy. That justifies why you have to provide pip as the package name and NOT pip3.
somewhat is a related note, you can also use the below to upgrade pip or any package for that matter.
easy_install-3.5 -U pip
Upvotes: 3