Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use pip with python3.5 after upgrade from 3.4?

I'm on Ubuntu and I have python2.7, (it came pre-installed) python3.4, (used before today) and python3.5, which I upgraded to today, installed in parallel. They all work fine on their own.

However, I want to use pip to install some packages, and I can't figure out how to do this for my 3.5 installation because pip installs for 2.7 and pip3 installs python 3.4 packages.

For instance, I have asyncio installed on 3.4, but I can't import it from 3.5. When I do pip3 install aysncio, it tells me the requirement is already satisfied.

I'm a bit of a newbie, but I did some snooping around install directories and couldn't find anything and I've googled to no avail.

like image 509
Lytigas Avatar asked Feb 08 '16 02:02

Lytigas


2 Answers

I suppose you can run pip through Python until this is sorted out. (https://docs.python.org/dev/installing/)

A quick googling seems to indicate that this is indeed a bug. Try this and report back:

python3.4 -m pip --version
python3.5 -m pip --version

If they report different versions then I guess you're good to go. Just run python3.5 -m pip install package instead of pip3 install package to install 3.5 packages.

like image 141
Harald Nordgren Avatar answered Nov 13 '22 12:11

Harald Nordgren


Another way would be to setup a virtual environment:

$ python3.4 -m venv envdir
$ source envdir/bin/activate
$ pip --version

Obviously, this won't install the packages globally and you'll have to source venv/bin/activate every time you wan to make use of it.

like image 44
Jashandeep Sohi Avatar answered Nov 13 '22 12:11

Jashandeep Sohi