Reputation: 2562
I'm running Ubuntu 12.04
and do not have the option of upgrading / using something else. It has Python3.2
on it. I have found out that pip
doesn't come automatically with < 3.4. How can I get pip
to work with Python3
on this machine?
I tried downloading a copy of get-pip.py
and running it with python3.2
, but I kept getting an error message about how < 3.4 support was dropped.
Upvotes: 0
Views: 1974
Reputation: 2562
I spent a little bit getting this all to work so I wanted to make a detailed post.
First I found out I could get Python3.4
onto my Ubuntu 12.04
machine. To do this run:
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python3.4
Source: Is There An Easy Way To Install Python 34 On
Next, I removed Python3.2
(I only wanted to have a single Python3.x version on my machine) by running:
sudo apt-get remove python3.2
sudo apt-get remove python3.2-minimal
Then, to get pip
I ran:
sudo curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
sudo python3.4 get-pip.py
Source: How To Install Pip On Ubuntu 12 04 LTS
At this point Python3.4
and pip
can both be ran. Example:
python3.4 main.py
pip3 install requests
At this point I wanted to be able to just use python3
to run python3.4
- trying just python3
kept telling me I had to install python-minimal
. Doing this reinstalled python3.2
for me which I did not want. Instead, I created an alias
by doing the following:
vim ~/.bashrc # Open the file for editing
Add: alias python3=python3.4
to the file.
. ~/.bashrc # Make the changes apply to the current session
Source: How Do I Create A Permanent Bash Alias
Upvotes: 1