pip

2020/10/01

uninstall via OS package manager

Cannot uninstall ‘pyparsing’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

reason: This error means that this package’s metadata doesn’t include a list of files that belong to it. Most probably, you have installed this package via your OS’ package manager, so you need to use that rather than pip to update or remove it, too.

solution (centos):

yum list | grep pyparsing
yum remove pyparsing

alternative: pip install --ignore-installed pyparsing. disadvantage: will leave unused dependency package there.

ref: https://stackoverflow.com/questions/53807511

python3 pip3

$ pip3
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main' from 'pip' (/opt/python3.7/lib/python3.7/site-packages/pip/__init__.py)

It is caused by Debain system, so Ubuntu will be affected as well. Use python3 -m pip install PACKAGE_NAME instead.

Or you can edit /usr/bin/pip3, change code from

from pip import main
if __name__ == '__main__':
    sys.exit(main.main())

to

from pip import __main__
if __name__ == '__main__':
    sys.exit(__main__._main())

pip mirror source

vim ~/.pip/pip.conf

[global]
index-url=http://mirrors.tencent.com/pypi/simple/
[install]
trusted-host=mirrors.tencent.com

License: (CC 3.0) BY-NC-SA

Search

    Table of Contents