pip3.4 -V refers to python2.7 installation

前端 未结 5 1807
庸人自扰
庸人自扰 2020-12-18 00:15

Edit-rephrased question to be less misleading

Is there a difference between pip3 and pip2? pip2 -V and pip3-V both produc

相关标签:
5条回答
  • 2020-12-18 00:41

    After reinstalling python3-pip (opensuse package) pip3 -V and pip3.4 -V produce correct output

    pip 7.1.0 from /usr/lib/python3.4/site-packages (python 3.4)
    

    I had actually also uninstalled pip2 in the process and strangely reinstalling pip2 with python get-pip (get-pip) changed my newly working pip3.4 to point to the python2 site-packages again. This I just changed by deleting the wrong pip3.4 and making a symlink to pip3

    0 讨论(0)
  • 2020-12-18 00:48

    You can use --python=python3 flag to specify the Python version you want to use.

    0 讨论(0)
  • 2020-12-18 00:59

    I too was facing the same problem, the following aliasing helped.

    alias pip3="python3 -m pip"

    0 讨论(0)
  • 2020-12-18 01:02

    I was struggling with the same issue on my EC2 and finally found the solution to it. You can use it in following way-

    python3 -m pip <install> <library>
    

    adding python3 -m before pip calls pip3 from the correct location. You can check its location as follows-

    python3 -m pip -V
    pip 19.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
    
    0 讨论(0)
  • 2020-12-18 01:05

    In Debian, I found three short files in /usr/local/bin: pip; pip3; and pip3.4. All were identical:

    #!/usr/bin/python
    
    # -*- coding: utf-8 -*-
    import re
    import sys
    
    from pip import main
    
    if __name__ == '__main__':
        sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
        sys.exit(main())
    

    By changing the very first shebang line of pip3 (with sudo) to

    #!/usr/bin/python3
    

    Then ensuring that the original pip was explicitly

    #!/usr/bin/python2
    

    All of my similar confusion and errors disappeared.

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