Bhupendra Singh Rautela
Bhupendra Singh Rautela

Reputation: 3606

How to replace python 2.7.16 to python 3?

MacBook-Pro:~ bsr$ pip install django

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: django in ./Library/Python/2.7/lib/python/site-packages (1.11.29)
Requirement already satisfied: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from django) (2013.7)

Due this error unable to install the djengo.

pip install django

Upvotes: 1

Views: 6565

Answers (1)

Diogenis Siganos
Diogenis Siganos

Reputation: 797

On the command line, run

$ python3

If you see an output like:

Python 3.8.0 (default, Apr 4 2020, 13:56:23) 

then you have both Python 3 and 2 installed in your machine. This means that you need to run pip3 install django.

If not, then:

  • you can reinstall Python from the official website

  • you can build Python from source

  • you can use this command (from Fareed Alnamrouti's answer in Updating Python on Mac):

$ brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python

Upvotes: 2

Related Questions