All links of one day
in a single page.
<Previous day - Next day>

rss_feedDaily RSS Feed
floral_left The Daily Shaarli floral_right
——————————— June 26, 2019 - Wednesday 26, June 2019 ———————————
python - pip - update - ubuntu -

D'après le fichier /usr/lib/python3.7/ensurepip/init.py (du module "ensurepip" dont l'utilité est de servir de bootstrap pour les environnements virtuels) aux lignes 61-67:


def version():
"""
Returns a string specifying the bundled version of pip.
"""
wheel_names = glob.glob('/usr/share/python-wheels/pip-*.whl')
assert len(wheel_names) == 1, wheel_names
return os.path.basename(wheel_names[0]).split('-')[1]

On remarque que la version de pip est déterminée par le package wheel situé dans /usr/share/python-wheels.

Dès lors, il suffit de mettre à jour pip comme suit:

$ cd ~/
$ pip3 download pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl
Saved ./pip-19.1.1-py2.py3-none-any.whl
Successfully downloaded pip

$ sudo mv pip-19.1.1-py2.py3-none-any.whl /usr/share/python-wheels
$ sudo mkdir /usr/share/python-wheels/old
$ sudo mv /usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl /usr/share/python-wheels/old/

$ cd ~/Projects/MyProject
$ python3 -m venv venv
$ source venv/bin/activate
$ pip --version
pip 19.1.1

TADAAAA !!!

ubuntu - alternative - python -

Une bonne astuce pour gérer plusieurs versions d'un programme (en l'occurrence: Python) sur un même PC sous Ubuntu

-