jupyter内核
介绍: (Introduction:)
When I first started using Python, the concept of a virtual environment was extremely elusive to me. It often took me hours of searching and experimenting with creating one only to end up more confused than when I had started.
当我第一次开始使用Python时,虚拟环境的概念对我来说是极其难以捉摸的。 通常,我花了数小时的时间进行搜索和尝试来创建一个,最终却比开始时更加困惑。
This article aims to be a one-stop-shop for understanding what virtual environments exactly do, how to create them, and linking them to your Jupyter Notebook.
本文旨在成为了解虚拟环境确切功能,如何创建虚拟环境并将其链接到Jupyter Notebook的一站式服务。
目录: (Table of Contents:)
- What is a Virtual Environment? 什么是虚拟环境?
- Create an Environment Using Anaconda 使用Anaconda创建环境
- Installing Packages into the Environment 将软件包安装到环境中
- Using Virtual Environments in Jupyter as Kernels 在Jupyter中将虚拟环境用作内核
- Deleting Environments and Kernels 删除环境和内核
什么是虚拟环境? (What is a Virtual Environment?)
Let’s first start with the story of Bob.
让我们首先从鲍勃的故事开始。
Bob works at a large financial firm as a Data Scientist. Bob and his team all use Python and regularly collaborate with each other on certain projects. However, since this financial firm is quite large, they all have numerous individual projects they are working on as well. Because of this, there needs to be a universal way to separate these projects from each other to ensure they run on any computer with Python installed. This is where virtual environments come into play.
鲍勃在一家大型金融公司担任数据科学家。 Bob和他的团队都使用Python,并在某些项目上定期相互协作。 但是,由于这家金融公司很大,因此他们都在从事许多单独的项目。 因此,需要一种通用的方法将这些项目彼此分离,以确保它们在安装了Python的任何计算机上运行。 这是虚拟环境发挥作用的地方。
You can think of a virtual environment as a specific copy of Python in your computer that you can specify yourself. This copy can be any version of Python with any packages installed. Using virtual environments ensures that there are certain barriers between projects. These barriers in place make sure that anyone can run your version of Python regardless of what is on their computer.
您可以将虚拟环境视为Python的特定副本 在计算机中, 您可以指定自己 。 此副本可以是安装了任何软件包的任何 Python版本。 使用虚拟环境可确保项目之间存在一定的障碍。 这些障碍确保了任何人都可以运行您的Python版本,而不管计算机上的内容是什么。