PIP module has no attribute “main”

前端 未结 5 1178
渐次进展
渐次进展 2021-01-04 02:18

EDIT: The computer in question was a client machine with restrictions on what software could be installed. I\'m unsure if that may have been a cause of the issue or if the c

5条回答
  •  温柔的废话
    2021-01-04 02:51

    they made a refactoring. you can support both 9 and 10 pip by using:

    try:
        from pip import main as pipmain
    except:
        from pip._internal.main import main as pipmain
    

    and then use pipmain as you used pip.main. for example

    pipmain(['install', "--upgrade", "pip"])
    pipmain(['install', "-q", "package"])
    

提交回复
热议问题