Error when running 'pip install -r requirement

2020-05-03 10:30发布

问题:

When i run following command in my Django project:

pip install -r requirements.txt --upgrade

I get following error:

Detected a distutils installed project ('argparse') which we cannot uninstall. The metadata provided by distutils does not contain a list of files which have been installed, so pip does not know which files to uninstall.

My requirements.txt file is as follow:

Django==1.8.1
MySQL-python==1.2.5
pycrypto==2.6.1
Pillow==2.4.0
simplejson==2.3.2
uWSGI==2.0.8
pyBarcode==0.7
python-dateutil==2.4.0
xlwt==0.7.5
xhtml2pdf==0.0.6
reportlab==3.1.8
pymssql==2.0.1
boto
raven==5.1.1
djangorestframework==3.2.2
djangorestframework-jwt
django-model-utils==2.3.1
django-rest-swagger==0.3.3
django-session-security
pytz==2014.4
testtools
extras
testscenarios
django-ipware

My pip version is pip 8.0.0 and I am using ubuntu. Can any one help to resolve issue?

回答1:

If you're using a virtualenv, this shouldn't happen,if it does, then here is a similar question to your problem.

OS X Uninstall a distutils installed project

If you do remove the argparse package, it can be installed again using pip.

Don't have enough reputation to write this as a comment yet. :(



回答2:

This sounds very much like you are hitting https://github.com/pypa/pip/issues/3384 - the temporary solution is to pin pip<8