0

How to install pip for python3.4 when my pi have python3.2 and python3.4

when I used sudo install python3-pip

it's only for python3.2

but I want install pip for python3.4

weijia.wang
  • 2,088
  • 2
  • 18
  • 32

3 Answers3

3

Python 3.4 has pip included, see What's New in Python 3.4.

Just execute:

python3.4 -m ensurepip

to install it if it is missing for you. See the ensurepip module documentation for further details.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • 1
    I had try it,but `Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS` , have other way?? -.-! – weijia.wang Sep 20 '15 at 11:33
  • @weijia.wang: without SSL support you won't be able to *use* `pip` anyway. How did you set up your Python 3.4 installation? Did you compile it from source? If so, you need to install the openssl header files too. – Martijn Pieters Sep 20 '15 at 11:36
  • @weijia.wang: on a Ubuntu or Debian based Raspberry you can install the `libssl-dev` package to get those headers, then recompile. See [this answer of mine](https://stackoverflow.com/questions/16447635/installing-distribute-in-python-3-3-ubuntu/16447683#16447683) for a more complete list of packages you may want to install before compiling Python. – Martijn Pieters Sep 20 '15 at 11:38
0

You can go to your python 3.4 directory scripts and run it's pip in:

../python3.4/scripts

Omid Goudazi
  • 120
  • 2
  • 9
0

You should compile python 3.4 and use venv for python3 environment:

  1. Check if you have installed required dependencies:

    sudo apt-get install build-essential
    
    sudo apt-get install libc6-dev libreadline-dev libz-dev libncursesw5-dev libssl-dev libgdbm-dev libsqlite3-dev libbz2-dev liblzma-dev tk-dev
    
  2. Download and compile Python 3.4.3. You should not sudo make install it because we don't need it systemwide:

    wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
    tar -xvf Python-3.4.3.tgz
    cd Python-3.4.3 
    ./configure && make
    

    This may take a while on pi.

  3. While you still in current folder, create python environment:

    mkdir -p ~/.virtualenvs
    ./python -m venv ~/.virtualenvs/py34
    
  4. launch your virtual environment:

    source ~/.virtualenvs/py34/bin/activate
    

Now you have Python 3.4 and pip inside of it. Try:

    pip install bpython

To exit virtual environment use:

    deactivate