2017-10-07 11:43:26 +09:00
|
|
|
---
|
|
|
|
title: Install Python and Jupyter on macOS with Minimal Effort
|
|
|
|
date: 2017-02-28 11:14:00 +09:00
|
2019-08-14 21:24:49 +09:00
|
|
|
redirect_from: "/blog/2017/02/28/minimal-python-jupyter-macos"
|
2017-10-07 11:43:26 +09:00
|
|
|
---
|
|
|
|
|
|
|
|
Maybe you don't need `pyenv` and/or `virtualenv` in most cases.
|
|
|
|
|
|
|
|
## Install Python
|
|
|
|
|
|
|
|
> Don't have `brew`? Go to <https://brew.sh>.
|
|
|
|
|
|
|
|
```
|
2022-12-24 03:20:02 +09:00
|
|
|
brew install python
|
2017-10-07 11:43:26 +09:00
|
|
|
```
|
|
|
|
|
2022-12-24 03:20:02 +09:00
|
|
|
If you still need Python 2, run `brew install python@2`.
|
2017-10-07 11:43:26 +09:00
|
|
|
|
|
|
|
## Install Jupyter Notebook
|
|
|
|
|
|
|
|
```
|
2022-12-24 03:20:02 +09:00
|
|
|
pip install jupyter
|
2017-10-07 11:43:26 +09:00
|
|
|
python -m ipykernel install --user
|
|
|
|
```
|
|
|
|
|
|
|
|
That's all.
|
|
|
|
|
|
|
|
# How about `virtualenv`?
|
|
|
|
|
2022-12-24 03:20:02 +09:00
|
|
|
Since Python 3 got its own virtual environment tool called [venv](https://docs.python.org/3/library/venv.html), You no longer need `virtualenv`.
|
2017-10-07 11:43:26 +09:00
|
|
|
|
|
|
|
If you want a virtual envs on your project, run:
|
|
|
|
|
|
|
|
```
|
2022-12-24 03:20:02 +09:00
|
|
|
python -m venv venv
|
2017-10-07 11:43:26 +09:00
|
|
|
source ./venv/bin/activate
|
|
|
|
```
|
|
|
|
|
2018-07-19 20:53:12 +09:00
|
|
|
then `venv` will creates virtual envs on **./venv** folder on the root of your project.
|