Pip problem when Python2 and Python3 coexist

Source: Internet
Author: User
Tags install django pip install django

Python2 and Python3 are installed on the Raspberry Pi at the same time, the initial pip is version 9.01, with the PIP install Django can only be installed to version 1.11, but I need 2.0 of Django.
Then upgrade PIP:

python -m pip install --upgrade pip

PIP upgrades to the latest version 18.0 and installs Django 2.0 successfully.

At this point, however, PIP3 can be used normally, and PIP2 will go wrong:

Traceback (most recent call last):   File "/usr/bin/pip", line 9, in <module>     from pip import main ImportError: cannot import name main

Because two versions of Python use the same pip, they affect each other and need to reinstall their version of PIP:

python3-m pip install --upgrade pip --force-reinstall
python2-m pip install --upgrade pip --force-reinstall

The use of PIP2,PIP3 is normal.

Pip problem when Python2 and Python3 coexist

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.