sawreals
sawreals

Reputation: 338

How to Set Default Version of Python to 3.x vs 2.7 on Mac OSX?

I am attempting to install django framework using pip install -e django/, however, it requires Python 3.5+. Mac OSX by default comes with Python 2.7 so I have installed Python 3.6.5 from the python website.

I have confirmed the latest version of Python is installed through python3 .

I am still unable to install Django likely because Python 2.7 is also installed and seen first by pip.

Is it necessary to remove Python 2.7 from my system or can I modify PYTHON_HOME to achieve what I would like to do?

Upvotes: 2

Views: 844

Answers (1)

Alasdair
Alasdair

Reputation: 309109

You can install to python 3 using

pip3 install django

python3 -m pip install django

As abarnert says in the comments, you shouldn't remove the Python 2.7 installation or try to set Python 3 to be the default.

It's good practice to use a virtual environment. Since you're using Python 3 you could use pipenv. Once the Python 3 virtual environment is activated, python will use the python 3 from the virtual environment.

Upvotes: 2

Related Questions