1. Install the Visual Studio Code (VS Code)¶
Install Visual Studio Code
2. Install Anaconda¶
To install Anaconda, download the installer from the Anaconda website. The installer will ask you to accept the license agreement, choose the installation directory.
3. Select interpreter in VS code¶
if it is your first time to select interpretr, you need to install two extensions from extensions in the left side bar:
- Python
- Jupyter
The Python:Select Interpreter (Ctrl+Shift+P) command displays a list of available gloabl environments, conda environments, and virtual environments.¶
4. Create a Juputer Notebook¶
You can create a Jupyter Notebook by running the Create: New Jupyter Notebook command from the Command Palette (Ctrl+Shift+P) or by creating a new .ipynb file in your workspace.
Or, you can select 'File' > 'New File'
5. Start your first Jupyter Notebook¶
- Developed originally by UC Berkeley's Ferando Perez
- Contain code & rich text elements
- Perfect for sharing your analysis with others
- Gret for sharing your analysis with others
6. Writing in Markdown¶
6.1 Change font size¶
- In markdown, we talk about headings instead of font size
- use # to adjust the size
Heading 1¶
Heading 2¶
Heading 3¶
sentence
6.2 Formtted text¶
- Different styling (bold/italic), bulleted lists, etc
- In Jupyter, we call these text elements markdown
Note: when you edit in VS Code, you can open Auto Save under File
print("Hello, python")
Hello, python
# This is comment: get result of 3+5
3+5
8
8. Save your Jupyter Notebook¶
You can save your Jupyter Notebook using the keyboard shortcut (Ctrl+S) or File > Save.
9. Export your Jupyter Notebook¶
You can export a Jupyter Notebook as a Python file (.py), a PDF, or an HTML file. To export, select ... > Export on the main toolbar. You're then presented with a dropdown of file format options.
10. Virtual environment¶
10.1 Create a virtual environment in terminal¶
Right click the Anaconda prompt and Run as Administrator (This step will ensure that your package is installed in Anaconda/env folder)
The following command creates a conda environment named np with a Python 3.9 interpreter
conda create -n np python=3.9
10.2 Check conda is installed¶
conda -V
10.3 List virtual environment¶
now if you list virgual envionment, you can see the virtual environment that you just create.
conda env list
For example, I have three virtual environment: base, arcpu_pro, np
10.4 Activate virtual environment¶
if you virtual environment named as 'np'
activate np
10.5 Install packages (e.g., numpy)¶
conda install numpy
11. Delete a no longer needed virtual environment¶
For example, delete a virtual environment 'np'
conda remove -n np --all -y