How to install pip for Python 3.6 on Ubuntu 16.10?

后端 未结 4 1707
野趣味
野趣味 2020-12-04 07:30

I\'d like to start by pointing out that this question may seem like a duplicate, but it isn\'t. All the questions I saw here were regarding pip for Python 3 and I\'m talking

4条回答
  •  醉话见心
    2020-12-04 07:48

    In at least in ubuntu 16.10, the default python3 is python3.5. As such, all of the python3-X packages will be installed for python3.5 and not for python3.6.

    You can verify this by checking the shebang of pip3:

    $ head -n1 $(which pip3)
    #!/usr/bin/python3
    

    Fortunately, the pip installed by the python3-pip package is installed into the "shared" /usr/lib/python3/dist-packages such that python3.6 can also take advantage of it.

    You can install packages for python3.6 by doing:

    python3.6 -m pip install ...
    

    For example:

    $ python3.6 -m pip install requests
    $ python3.6 -c 'import requests; print(requests.__file__)'
    /usr/local/lib/python3.6/dist-packages/requests/__init__.py
    

提交回复
热议问题