简体   繁体   English

在 anaconda 上安装软件包如何工作?

[英]How does installing packages on anaconda work?

To install a package, I know I have to create an environment in Anaconda.要安装package,我知道我必须在Anaconda中创建一个环境。 I was wondering if I could create an environment and add 3-4 packages such as Matplotlib, Keras, Tensorflow together, or would that cause some error?我想知道我是否可以创建一个环境并添加 3-4 个包,例如 Matplotlib、Keras、Tensorflow,还是会导致一些错误?

If you already have your environment created, you activate it on the anaconda command console and then you add the packages as you can see in the following link:如果您已经创建了环境,请在 anaconda 命令控制台上激活它,然后添加包,如以下链接所示:

https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/ https://docs.anaconda.com/anaconda/user-guide/tasks/install-packages/

Most of the high profile packages as the ones you listed have no issues being installed on the same environment您列出的大多数高级软件包在同一环境中安装都没有问题

You can certainly do that.你当然可以这样做。 Just run conda install matplotlib keras tensorflow after making your environment.只需在创建环境后运行conda install matplotlib keras tensorflow

Why It Works The reason this works is because an environment is a place where an interpreter and a collection of libraries reside.为什么会起作用 之所以起作用,是因为环境是解释器和库集合所在的地方。 The reason we do this is so that we can have many versions of the same library in the same computer.我们这样做的原因是我们可以在同一台计算机上拥有同一个库的多个版本。 It is a sandbox for libraries.它是图书馆的沙箱。 Unless you try to install different versions of the same library on the same environment, you can install as many packages as you like.除非您尝试在同一环境中安装同一库的不同版本,否则您可以安装任意数量的软件包。

What does Anaconda Do? Anaconda 有什么作用? All Anaconda is doing is making a wrapper so that every time you enter the environment, your python commands redirect to the separate python executable in the env folder.所有 Anaconda 正在做一个包装器,以便每次进入环境时,您的 python 命令重定向到env文件夹中单独的 python 可执行文件。 It also sends all the library requests to that env to handle.它还将所有库请求发送到该环境以进行处理。 This means that you can use a hundred libraries without installing one globally on your computer.这意味着您可以使用一百个库,而无需在您的计算机上全局安装一个。

How To Setup Anaconda如何设置 Anaconda

  1. Open Anaconda Navigator and click the Environments button.打开 Anaconda 导航器并单击环境按钮。 在此处输入图像描述

  2. Click create点击创建在此处输入图像描述

  3. Name it and select the Python interpreter that you have.将它命名为 select 您拥有的 Python 解释器。 在此处输入图像描述

  4. Hit create and then on the dropdown, select all.点击创建,然后在下拉菜单中,select all。 在此处输入图像描述

  5. Then say you want to install Matplotlib, then go to the search bar and search it up.然后说你要安装Matplotlib,然后go到搜索栏搜索一下。 在此处输入图像描述

  6. Then select the package you want and hit apply.然后 select package 你想要并点击应用。 在此处输入图像描述

7. It will ask for confirmation and then the package should be installed. 7.它会要求确认,然后应该安装package。 You can install as many as you like.您可以安装任意数量的。 Also, to see the packages you have installed, select Installed instead of All in the dropdown.此外,要查看您已安装的软件包,请在下拉列表中选择 select Installed 而不是 All。 You can put all of your packages in one place!您可以将所有包裹放在一个地方!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM