为什么(或为什么不)将 Anaconda 添加到路径? [英] Why (or why not) Add Anaconda to path?

查看:49
本文介绍了为什么(或为什么不)将 Anaconda 添加到路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这个问题中找到了部分答案:是否将 Anaconda 添加到路径

I have found a partial answer in this question: Adding Anaconda to Path or not

但我还是没有完全理解.从普通安装 Python 切换到 Anaconda 时,我遇到了很多安装问题,需要我完全重新安装 Windows……所以我想现在就解决这个问题.

But I still don't fully understand. I have had a lot of installation issues when switching from a normal installation Python to Anaconda, requiring me to completely re-install Windows... So i want to get this right now.

当我将 Anaconda(或 python)添加到 PATH 时,内部会发生什么?我计划使用不同 python 版本的单独 conda 环境,如果我将 Anaconda 添加到安装路径?在安装中执行此操作或稍后通过命令提示符执行此操作有什么区别?它会影响我将 anaconda 与 PyCharm 集成的能力吗?

What happens internally when I Add Anaconda (or python for that matter) to the PATH? I plan on working with seperate conda environments for different python versions, what could go wrong if I add Anaconda to path in the installation? And what is the difference between doing it in the installation or doing it later through the command prompt? Will it affect my ability to integrate anaconda with PyCharm?

推荐答案

PATH 是一个环境变量,它是可执行程序所在位置的列表(另请参见 维基百科页面.

PATH is an environment variable that is a list of locations where executable programs lie (see also the wikipedia page.

每当您在命令行中尝试执行某个程序时,例如 regedit,那么 cmd 就不会神奇地知道您的意思是 C:Windows egedit.exe.相反,它会在 PATH 中的所有位置搜索名为 regedit 的可执行文件,并在 C:Windows 中找到它,这是标准部分之一PATH 在 Windows 中.

Whenever you are in your command line and try to execute some program, for example regedit, then the cmd does not magically know that you mean C:Windows egedit.exe. Instead, it searches all locations in your PATH for an executable named regedit and finds it in C:Windows which is one of the standard parts of PATH in Windows.

这也是,为什么在 PATH 弄乱如果你不知道你在做什么会很危险,因为它可能会导致事情不再工作,如果,例如您删除部分路径或向其中添加自定义目录.

That is also, why messing with the PATH can be dangerous if you don't know what you are doing, because it might lead to things not working anymore if, for example you delete parts of the path or add custom directories to it.

话虽如此,您现在应该知道将 anaconda 添加到路径"时会发生什么.这只是意味着,Anaconda 将其可执行文件所在的目录添加到 PATH 中,因此可以在例如您在 cmd 中键入 conda 时找到它.

That being said, you should now have an idea what happens when you "Add anaconda to path". It simply means, that Anaconda adds the directory where its executables lie to the PATH, hence making it findable when, for example you type conda in your cmd.

话虽如此,将 Anaconda 添加到 PATH 是方便的事情,因为总是可以自动找到这些命令,并且其他程序也会扫描您的 PATH 用于 python 可执行文件.

That being said, adding Anaconda to PATH is something that is convenient, beacuse the commands can always be found automatically and they will also be found by other programs scanning your PATH for a python executable.

同时它没有必要.当您使用例如pycharm,那么你可以指定pycharm内部解释器的路径.它不一定需要出现在您的 PATH 中.

At the same time it is not neccessary. When you use e.g. pycharm, then you can specify the path to the interpreter inside of pycharm. it does not neccessarily need to be present in your PATH.

注意:

我个人将它放在我的 PATH 中,因为每次我在 cmd 中需要它时我都懒得打开 Anaconda 提示,而且我看不到它的危害如果您了解后果并且无论如何它都是我唯一的python安装.

I personally have it on my PATH because I am too lazy to open an Anaconda prompt each time I need it in a cmd and I do not see the harm in it if you understand the consequences and its my only python installation anyway.

也有帮助:

在 Windows 上,您可以使用 where 命令来查找命令从何处加载.例如:

On windows, you can use the where command to find out from where commands are laoded. For example:

where regedit

给予

 C:Windows
egedit.exe

这在尝试调试 PATH 问题时特别有用

This can be esspecially helpful when trying to debug PATH issues

这篇关于为什么(或为什么不)将 Anaconda 添加到路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆