简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM