本文介绍了conda为什么要创建新的安装环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人建议我创建一个用于安装Tensorflow的新环境

I was suggested to conda create a new environment for installing tensorflow

第一个问题,一般来说:

First question, in general:

为什么conda或Python中存在环境? (为什么)最好在新环境中安装新库?

Why do environment exist in conda or in Python ? (Why) is it preferable to install a new library in a new environment ?

在这里,实际上:

在安装conda shell之后,说$conda activate test将激活test环境.这是否意味着除非在conda shell中激活test,否则我无法访问Spyder中的lib?我需要重启python shell才能看到lib吗?我无法访问lib(no module named tensorflow),并且我认为它与python找不到路径有关.

After install conda shell says $conda activate test will activate the test environment. Does it mean i can't access the lib in Spyder unless i activate test in conda shell ? Do i need to restart python shell to see the lib ? I can't access the lib (no module named tensorflow) and I assume it has to do with python not finding the path.

推荐答案

您是否已在环境中安装了TF?

Have you installed TF within the environment?

我已经有一段时间没有使用Spyder了,但是通常会发生的情况是,如果您已在其中安装了应用程序并且该环境处于活动状态,则可以从该环境中启动程序(例如Spyder或Jupyter). (某些编辑器/IDE(如VS Code)可让您选择特定项目的环境,只要它能够发现所有环境即可.)

I haven't used Spyder in a while, but what usually happens is that you can start a program (like Spyder or Jupyter) from an environment if you have installed the application within it and the environment is active. (Some editors/IDE like VS Code lets you choose the environment for a specific project, once it is able to discover all the environments.)

而且,通常(尽管可能并非总是如此),在安装库之后,您无需重新启动Shell即可导入库.最好参考特定库的安装说明以获取类似的详细信息.

And, also usually, though perhaps not always, you will not need to restart the shell to import a library, after installing it. It's best to refer to the specific library's installation instructions for details like this.

这篇关于conda为什么要创建新的安装环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 22:34