In this article, I will tell you how to create Python virtual environment, how to start a Jupyter notebook web server, and how to create a Jupyter notebook file in Anaconda.
1. Create A Python Virtual Environment In Anaconda.
- Click Windows Start —> Anaconda3(64-bit) —> Anaconda Navigator(Anaconda) menu item.
- In the opened anaconda navigator window, click the Environments menu item on the left side, then click the Create button on the middle bottom to create a python virtual environment.
- If you want to create or manage an Anaconda virtual python environment with a command line, you can read the article How To Manage Anaconda Environments.
2. Start Jupyter Notebook In Above Python Virtual Environment.
- In the Anaconda Navigator virtual python Environments list, click the green triangle button at the end of the python virtual environment, then click the Open Terminal menu item in the popup menu list.
- Then it will pop up a command-line console window. Go to the folder where you want to save your Jupyter notebook files and python script files use the cd command like below.
(env_jupyter_example) C:\Users\song zhao > cd C:\WorkSpace\JupyterExampleProject\JupyterSlideBarExample
- Then run the command jupyter notebook to start Jupyter notebook web server. Then all the Jupyter notebook files and folders will be saved in this folder.
(env_jupyter_example) C:\WorkSpace\JupyterExampleProject\JupyterSlideBarExample>jupyter notebook [I 09:50:36.790 NotebookApp] JupyterLab extension loaded from C:\Anaconda\lib\site-packages\jupyterlab [I 09:50:36.791 NotebookApp] JupyterLab application directory is C:\Anaconda\share\jupyter\lab [I 09:50:36.865 NotebookApp] Serving notebooks from local directory: C:\WorkSpace\JupyterExampleProject\JupyterSlideBarExample [I 09:50:36.865 NotebookApp] The Jupyter Notebook is running at: [I 09:50:36.867 NotebookApp] http://localhost:8888/?token=7b4366a32146528811158f6400bec3f8afee5d8f7c1eb157 [I 09:50:36.867 NotebookApp] or http://127.0.0.1:8888/?token=7b4366a32146528811158f6400bec3f8afee5d8f7c1eb157 [I 09:50:36.867 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 09:50:37.032 NotebookApp] To access the notebook, open this file in a browser: file:///C:/Users/song%20zhao/AppData/Roaming/jupyter/runtime/nbserver-2924-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=7b4366a32146528811158f6400bec3f8afee5d8f7c1eb157 or http://127.0.0.1:8888/?token=7b4366a32146528811158f6400bec3f8afee5d8f7c1eb157
- When the above process complete, it will open a web browser and list all the files that exist in the current folder ( in this example it is C:\WorkSpace\JupyterExampleProject\JupyterSlideBarExample).
3. Create Jupyter Notebook Python File, Text File, Folder, And Terminal.
- Click the New button on the top right corner of the Jupyter notebook files list page, then it will popup a menu list. There are 4 menu items in the list, you can create Python 3 notebook file, Text File, Folder, and Terminal.
- Click New —> Python 3 menu item to create a Jupyter notebook file. Then it will open a new web browser tab and you can write ipython command in the Jupyter notebook file.
- If you want to run python 2 code in Jupyter notebook, please read the article How To Run Python 2 Code In Jupyter Notebook
- Click New —> Text File menu item to create a new text file.
- Click New —> Folder menu item to create a new folder. The default folder name is Untitled Folder.
- Click New —> Terminal menu item to open a terminal in a new web browser tab. In this terminal, you can run commands such as ls, pwd no matter which OS ( Windows, Linux, macOS, etc ) you are using.
4. Edit ( Rename, Move, Download, Delete ) Jupyter Notebook File, Folder.
- If you want to rename the Jupyter notebook file when edit it, just double click the file name ( Untitled ) at top left corner of the page, then it will popup a dialog to let you rename it. You can input the new Jupyter notebook name in the input text box then click the Rename button to change it.
- You can also manage the Jupyter notebook file or folder in the list page by check the checkbox before the file or folder name, then click Rename, Move, Download, Delete button at top area of the list.
- But if a Jupyter notebook file is running ( such as you are editing it ) when you check it, it will show a brown color Shutdown button, you should first click this button to shutdown it before you can manage it.
- How To Use IPython Jupyter Notebook To Develop Python Code
- How To Manage Anaconda Environments
- How To Run Python 2 Code In Jupyter Notebook