Gangmax Blog

Jupyter Notebook

Here is the commands which I used to create the “Jupyter Notebook” environment.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# You need to have "pyenv" installed first.
# 1. Install miniconda.
pyenv install miniconda3-4.7.12
cd project_dir
# 2. Set miniconda as the default Python intepretor of the project directory.
pyenv local miniconda3-4.7.12
# 3. Update conda.
conda update conda
# 4. Create a conda environment.
conda create --name jupyter python=3.8
# 5. List the existing conda environments.
conda env list
# 6. Use the created conda environment.
conda activate jupyter
# 7. Run this to make conda be activated when starting a shell.
# This will add some content into your "~/.zshrc" file.
conda init zsh
# 8. Install Jupyter Notebook.
conda install -c conda-forge notebook
# 9. Install matplotlib which is required if you want to create chart in your notebook.
pip install matplotlib
# 10. Start notebook.
jupyter notebook

Here is the content added by “conda init zsh” in the “~/.zshrc” file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/auser/.pyenv/versions/miniconda3-4.7.12/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/auser/.pyenv/versions/miniconda3-4.7.12/etc/profile.d/conda.sh" ]; then
. "/Users/auser/.pyenv/versions/miniconda3-4.7.12/etc/profile.d/conda.sh"
else
export PATH="/Users/auser/.pyenv/versions/miniconda3-4.7.12/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<

Comments