Traceback (most recent call last):
File "/usr/local/bin/pip2", line 7, in
from pip import main
ImportError: cannot import name main
easy_install命令报错
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 6, in
from pkg_resources import load_entry_point
File "/Users/Andy/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 72, in
import packaging.requirements
File "/Users/Andy/Library/Python/2.7/lib/python/site-packages/packaging/requirements.py", line 59, in
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: __call__() takes exactly 2 arguments (1 given)
1. 升级pip10后,对应2.7版本需要修改pip文件,main不在pip package下,而在pip._internal中
2. PyCharm 安装包会调用pip及easy_install
# -*- coding: utf-8 -*-
import re
import sys
#from pip import main
from pip._internal import main as main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
pip install --upgrade setuptools --user python