This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to install argparse for python 2.7

Hi guys,

I've to install argparse package for phyton version 2.7.

I tried with the following command:

python2 -m pip install argparse

and the shell returned me

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: argparse in /usr/lib/python2.7 (1.2.1)

When I ran the following command:

pip list

argparse didn't figure among the installed packages of python, since I found:

Package         Version
--------------- -------
bitarray        2.1.0
joblib          0.14.1
numpy           1.16.6
pandas          0.24.2
pip             20.3.4
python-dateutil 2.8.1
pytz            2021.1
scipy           1.2.3
setuptools      44.1.1
six             1.16.0
wheel           0.36.2

How can I install this package?

my python version is:

Python 2.7.18 (default, Mar  8 2021, 13:02:45)
[GCC 9.3.0] on linux2

my pip version is:

pip 20.3.4 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

my server system is:

Linux platonesrv1 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Thank u!

python2 pip

Have you tried removing and re-installing argparse?

When I run the following command to uninstall argparse:

pip uninstall argparse

I found:

Found existing installation: argparse 1.2.1
Not uninstalling argparse at /usr/lib/python2.7, as it is in the standard library.
Can't uninstall 'argparse'. No files were found to uninstall.

I guess you should be able to import it directly, without explicit installation.

Try running: import argparse on python interpreter and see what happens. Usually, it should be ok.

argparse is in the standard python library - you probably should not install it. Do you have a problem when you just try to import it?

I've tried to import it in the interactive shell of python and it seems that it works. Thank u so much to all of you!

0 answers

No answers yet.

Log in to answer this question.