Publicidad

Setting-Up Python Environment (Jupyter Notebook)

6 de May de 2022
Publicidad

Más contenido relacionado

Similar a Setting-Up Python Environment (Jupyter Notebook)(20)

Más de NopphawanTamkuan(20)

Publicidad

Setting-Up Python Environment (Jupyter Notebook)

  1. Center for Research and Application for Satellite Remote Sensing Yamaguchi University Setting-Up Python Environment (Jupyter Notebook)
  2. Contents: This manual is to help in setting up the environment for running python code as well as Jupyter notebook. Contents are arranged in following manners:- 1. Creating a project 2. Activating the Environment 3. Installing the libraries 4. Listing the libraries 5. Making the virtual environment compatible with jupyter notebook 6. Jupyter notebook running
  3. • Create a folder for the project • Using GUI or • Through shell: $ mkdir <project name> • Change path: $ cd <project path> • Creating a virtual environment for our project (generally same as project name for easy to remember) . • $ conda create --name <virtual environment name> <python=version> *In place of ‘conda’ we can also use Python package manager (‘pip’ or ‘pip3’). It will be mostly same with few exceptions. Creating a Project
  4. • $ conda info —envs (For listing all the virtual environments) • $ conda activate <virtual environment name> OR • $ source activate < virtual environment name> (Activate the virtual environment that we want to use for our project) • After that we can see virtual environment name in starting of prompt. • For deactivating this: $ conda deactivate • For removing: $ conda env remove -–name <virtual environment name> Activating the Environment
  5. • $ conda install <libraryName1 libraryName2> • Libraries for ex. OpenCV, TensorFlow, PyTorch, Keras etc. • $ conda install tensorflow • $ conda install pytorch torchvision -c pytorch *detail description has been provided on other manual namely libraries_setup Installing the libraries
  6. • $ conda list (this command will list all the installed libraries/packages) Listing the libraries
  7. • $ conda install ipykernel • $ ipython kernel install --user --name=<virtual environment name> • $ jupyter notebook & (For running jupyter notebook) • It will give a string with token (Highlighted with red ellipse) which can be copy pasted in browser to run the instance of the notebook Making the Virtual Environment compatible with Jupyter
  8. • Create a new notebook using the Kernel which has been created in last exercise (for example here Python_Learning). Jupyter Notebook
  9. • Jupyter notebook gives the flexibility to run a block of code (called cell) at a time, by using Run button( ) or using shortcut Shift+Enter(return) key. Output Kernel Writing a Simple Program in Jupyter Notebook
Publicidad