How do I use pip 3 with Python 3.4?

前端 未结 3 1616
后悔当初
后悔当初 2020-12-02 10:00

My OS is Lubuntu 14.04 and the default Python version is Python 2.7.6, but in

/usr/bin

it says I have Python 3.4 installed (when I run

3条回答
  •  温柔的废话
    2020-12-02 10:36

    In previous (X)Ubuntu versions it would be found under pip3 in your bash terminal, but such command didn't appear for me in Xubuntu 16.04.1 LTS. I founded pip (version python2.7), pip2 and pip2.7.

    You know pip is in the repositories under python3-pip. If you want to use pip in the repo firstly you must have it installed. Answering your question,

    How to use pip3 in Ubuntu:

    sudo python3 -m pip install 
    

    Maybe for you is easier to have pip3 as a command. Then, you need to upgrade it:

    sudo python3 -m pip install --upgrade pip
    

    It will create pip3 and pip3.5 **but** it modifies pip too. It did for me, now if I do pip -V it shows (python 3.5). Maybe this replacement is the reason Ubuntu doesn't include the pip3 binaries as commands.

    Update June 2019:

    I'm using Ubuntu 18.04.x LTS since last year. I founded locally installed (in ~/.local) pip command pointing to pip2 (like python always points to python2) and pip3 pointing my last version of pip for python3.x as expected. So it is safe to install the package python3-pip from the repo. Although python2 was installed at system level at the beginning, it did not include pip or pip2 command in /usr/bin/

提交回复
热议问题