# 1. Install "miniconda". bash ./Miniconda3-latest-MacOSX-x86_64.sh # You can change the installation directory in the installation process. # Note that the installation script will tell you it adds content to your # "~/.bash_profile" file. If you are using zsh like me, remember copy the # adding line to your "~/.zshrc" file. And if you are also "pyenv" user # like me, do remember "conda" overrides your Python environment provided # by "pyenv". # 2. Install conda package. conda install numpy conda install jupyter
pyenv install --list pyenv install miniconda3-4.3.30 pyenv local miniconda3-4.3.30 which conda conda install jupyter jupyter notebook
Jupyter
After you install Jupyter via conda, you can run it by:
1
jupyter notebook
IPython Notebook
The command will start a web server listening on the “8888” port and you will be navigated to the URL “http://localhost:8888/“ automatically. In the web page, go to “New -> Notebook: Python 3”. A new browser tab is opened which is an IPython notebook and a corresponding “Untitled.ipynb” file is created to save the notebook. You can run Python code and shell commands there by typing the content and press “Shift + Enter” to execute.
# Run Python code to verify the execution result of the magic command above. >>> # Let's check what this file contains. withopen('test.txt', 'r') as f: print(f.read()) Hello world!
# Show the help information of a magic command. >>> %run? Docstring: Run the named file inside IPython as a program.
# Switch "Code cell" to "Markdown" cell before running the following # code to render markdown content. >>> $$\hat{f}(\xi) = \int_{-\infty}^{+\infty} f(x) \, \exp \left(-2i\pi x \xi \right) dx$$ >>> ![This is a image](http://jupyter.org/assets/nav_logo.svg)
### Run the following code to display rich web content. >>> from IPython.display import HTML, SVG, YouTubeVideo