My solution is adding import pip
to the script linked to the pip/pip3
commands.
Firstly, open the file (e.g. /usr/local/bin/pip
) with your favorite text editor and the sudo mode. For example, I use sudo vim /usr/local/bin/pip
to open the script file.
You will obtain some file as following:
import re
import sys
from pip._internal import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
Afterwards, insert the statement import pip
just before the from pip._internal import main
then the issue is resolved.