mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Merge pull request #872 from kcolton/patch-1
(osx) how to make `python` reference `python3`
This commit is contained in:
@@ -102,6 +102,22 @@ will launch the homebrew-installed Python 3 interpreter.
|
|||||||
If the Homebrew version of Python 2 is installed then ``pip2`` will point to Python 2.
|
If the Homebrew version of Python 2 is installed then ``pip2`` will point to Python 2.
|
||||||
If the Homebrew version of Python 3 is installed then ``pip3`` will point to Python 3.
|
If the Homebrew version of Python 3 is installed then ``pip3`` will point to Python 3.
|
||||||
|
|
||||||
|
The rest of the guide will assume that ``python`` references Python 3. You can simply choose to always invoke ``python3`` instead, and much is backwards compatible. However, performing the following steps will set Python 3 as the default interpreter for ``python`` in a shell.
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
# Do I have a Python 2 problem?
|
||||||
|
$ python --version
|
||||||
|
Python 2.7.10 # Referencing OSX system install
|
||||||
|
$ which python
|
||||||
|
/usr/bin/python # Yup, homebrew's would be in /usr/local/bin
|
||||||
|
|
||||||
|
# Symlink /usr/local/bin/python to python3
|
||||||
|
$ ln -s /usr/local/bin/python3 /usr/local/bin/python
|
||||||
|
|
||||||
|
$ python --version
|
||||||
|
Python 3.6.4 # Success!
|
||||||
|
# If you still see 2.7 ensure in PATH /usr/local/bin/ takes pecedence over /usr/bin/
|
||||||
|
|
||||||
Pipenv & Virtual Environments
|
Pipenv & Virtual Environments
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user