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

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

问题描述

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

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\regedit.exe.而是在PATH中的所有位置中搜索名为regedit的可执行文件,然后在C:\Windows中找到它,这是Windows中PATH的标准部分之一.

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\regedit.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将其可执行文件所在的目录添加到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\regedit.exe

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

This can be esspecially helpful when trying to debug PATH issues

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

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