I have been attempting to upgrade argparse
on Ubuntu 16.04 to the latest version, but pip
keeps saying that it is part of the standard library.
How can this package be upgraded?
$ sudo pip install argparse --upgrade
Collecting argparse
Using cached argparse-1.4.0-py2.py3-none-any.whl
Installing collected packages: argparse
Found existing installation: argparse 1.2.1
Not uninstalling argparse at /usr/lib/python2.7, as it is in the standard library.
Successfully installed argparse-1.2.1
Thanks.
Argparse is maintained as a separate package here: https://pypi.python.org/pypi/argparse Which is where pip is going to collect it.
But
As of Python >= 2.7 and >= 3.2, the argparse module is maintained within the Python standard library. For users who still need to support Python < 2.7 or < 3.2, it is also provided as a separate package....
So, you are getting the error because it is part of the standard library, but also available to install via pip if you are using a version of Python for which it isn't.
If you really need to install 1.4.0 try this: (worked for me on my Windows 2.7.11 install)
argparse-1.4.01
folderpython setup.py install
(See the 'Install' section of first link)And check you now have the correct version (hopefully):
>>> import argparse
>>> argparse.__version__
'1.4.0'
Note:
This still leaves the original argparse.py
(in ...Python27\Lib
for me) intact, and places the 1.4.0 egg in site-packages
, with an easy-install.pth
file which I presume ensures that this version gets used in preference to the standard library one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With