Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Methods of conda Virtual Environment Management and jupyter Kernel Management in python

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "conda virtual environment management and jupyter kernel management in python". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

First, use the system's own python interpreter to create a python virtual environment.

1. Install virtualenv

Python3-m pip install virtualenv

two。 Create a virtual environment (here the python version of the virtual environment is closely related to the python version that runs step 1! Step 1 runs using python3, and the virtual environment created in step 2 is the first step of python3! )

Virtualenv env

3. Activate the virtual environment (activate in the bin directory)

Source env/bin/activate

4. Exit the virtual environment

Deactivate II. Use Anaconda to create a python virtual environment

The following operations apply to both windows and linux

1. Create a virtual environment using conda

Conda create-n your_env_name python=X.X (2.7,3.6, etc.)

two。 Check what virtual environments currently exist

Conda env list

3. Activate the virtual environment

Conda activate your_env_name

4. Close the current virtual environment

Conda deactivate

5. Delete virtual environment

Conda remove-n your_env_name-- all III. Jupyter add or remove kernels

Method 1: 1. Switch to the environment you want to add and confirm that ipykernel is installed

Python-m ipykernel-- version

If not, install: python-m pip install ipykernel

2.jupyter installs the kernel (kernel)

Python-m ipykernel install-- user [--name=]

Note: in the linux system, due to user rights issues, can not be omitted-- user!

3. View jupyter notebook kernel

Jupyter kernelspec list

4.jupyter deletes the kernel

Jupyter kernelspec remove kernelname

Method 2: add conda virtual environment to jupyter

After execution, the corresponding kernel configuration file will be generated under C:\ Users\ user name\ AppData\ Roaming\ jupyter\ kernels

1. Install nb_conda

Conda install nb_conda ipykernel

2. Enter the conda virtual environment and add the virtual environment to the kernel

Pip install ipykernelipython kernel install-user-name env_name# python-m ipykernel install-user-name virtual environment name-display-name "name displayed in jupyter browser"methods of conda virtual environment management and jupyter kernel management in python" is introduced here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report