Python is an increasingly popular high-level programming language. It emphasizes legibility over highly complex structure. Python innately provides simple data structures allowing for easy data manipulation. Python provides a simple approach to object-oriented programming, which in turn allows for intuitive programming, and has resulted in a large user community that has created numerous libraries that extend the basic capacities of the language.
The Anaconda makes configuring Python programing environment super easy. The Anaconda is cross-platform and it is very easy to install different libraries in the virtual environment. The following tutorial will walk you through the tutorial for installing Anaconda and required Python modules.
- Download the Anaconda. Go to the website to download Anaconda for different OSs.
Select the right Anaconda for your computer. In this tutorial, we are going to use Python 3.8.
- Locate you installer and install. Locate you downloaded Anaconda installer and then double click it to install. For Windows and MacOS, the installing is the same, just keep following the instructions by default.
- Check your installation. When you installation is done, you can then check if you have the Anaconda installed successfully. For Windows, press windows button and see if you have
Anaconda Prompt
. For Mac, go to your terminal and type inconda
.
When you have the Anaconda installed successfully, then you can open your Anaconda terminal (command line) and create virtual environment for Python programming.
For Mac, go to the terminal
,
- Type in
conda info -e
in your terminal, you should see thebase
environment. Thebase
is the default Python environment. We usually don't install Python modules in thebase
. - Create a customized virutal environment called
geoviz
,conda create --name geoviz
. You can use other names as you like. Let - Install the required modules. Before you get started to install Python modules, we need to first activate the virtual environment we just created. Just type in
conda activate geoviz
in the terminal.- install
geopandas
, type inconda install -c conda-forge geopandas
in the terminal. - install
jupyter
, type inpip install jupyter
in the terminal. - install
cartopy
, type inpip install cartopy
in the terminal.
- install
It is pretty straightforward to install the modules you need in Anaconda. In most cases just type in
conda install name_module
, orpip install name_module
.
Now we have the required environment ready. Let's start the Jupyter Notebook
and then write your Python code.
-
Go to your terminal. Make sure the
geoviz
is activated. Note: If you still see thebase
, you need to activate it first by typingconda activate geoviz
in the terminal. If you want to go back to base, you can also deactivate it,conda deactivate
. In this way, you can swich between different virtual environment, which can be created for different purposes. -
Start the Jupyter Notebook by typing
jupyter notebook
in the terminal. Then you web browser will start automatically and guide you to the notebook. You can then write Python code over there.
Go to open the test Jupyter Notebook file link. You can open the ipynb
file directly or copy the statment to you newly created notebook.
- Jupyter notebook for beginners, https://realpython.com/jupyter-notebook-introduction/
- Notebook Basics, https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Notebook%20Basics.html