pip: no module named _internal

前端 未结 26 2004
梦谈多话
梦谈多话 2020-12-02 12:08

I have a problem when I try to use pip in any way. I\'m using Ubuntu 16.04.4

I should say that I\'ve used it already, and I never had any problem, but starting today

相关标签:
26条回答
  • 2020-12-02 12:35

    This command works for me.

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py --force-reinstall --user

    0 讨论(0)
  • 2020-12-02 12:36

    This issue maybe due to common user do not have privilege to access packages py file.
    1. root user can run 'pip list'
    2. other common user cannot run 'pip list'

    [~]$ pip list
    Traceback (most recent call last):
      File "/usr/bin/pip", line 7, in <module>
    from pip._internal import main
    ImportError: No module named pip._internal
    

    Check pip py file privilege.

    [root@]# ll /usr/lib/python2.7/site-packages/pip/  
    合計 24  
    -rw-------  1 root root   24  6月  7 16:57 __init__.py  
    -rw-------  1 root root  163  6月  7 16:57 __init__.pyc  
    -rw-------  1 root root  629  6月  7 16:57 __main__.py  
    -rw-------  1 root root  510  6月  7 16:57 __main__.pyc  
    drwx------  8 root root 4096  6月  7 16:57 _internal  
    drwx------ 18 root root 4096  6月  7 16:57 _vendor  
    

    solution : root user login and run

    chmod -R 755 /usr/lib/python2.7 
    

    fix this issue.

    0 讨论(0)
提交回复
热议问题