gpt4 book ai didi

python - Anaconda Prompt 和 Anaconda Powershell Prompt 有什么区别?

转载 作者:太空宇宙 更新时间:2023-11-04 04:09:15 29 4
gpt4 key购买 nike

我正在使用 Anaconda 学习 Python。早些时候我只有 Anaconda Prompt。但是最近通过

更新了 Anaconda 之后
conda update conda

我是来看Anaconda Powershell Prompt的。我在新的 Powershell Prompt 中尝试了一些命令,而我之前在 Anaconda Prompt 中尝试过这些命令。这些命令运行良好。

现在,我的问题是 Anaconda 给出 2 个命令提示的原因是什么?它们的功能或能力之间有什么区别吗?

我的操作系统是 Windows 7,Conda 版本是 4.6.12。

最佳答案

首先,对于执行 python 相关命令的所有内容(pythonipythonjupyterconda 等) .) 到运行 Python 脚本(例如 python helloworld.py),没有区别。所以不用担心 ;)

然后,顾名思义,唯一的区别是运行 conda 命令的 windows shell 环境:cmd.exe(命令提示符)与 powershell.exe


现在让我们多谈谈区别:( reference )

Briefly, the cmd.exe is a simple shell introduced with Windows NT with the same basic syntax and functionality as DOS. It has relatively limited capabilities, especially when compared to Unix/Linux shells.

And PowerShell is a modern shell implementation with all sorts of extra goodies (e.g. commands colorful highlight).

因此,在 Anaconda Powershell Prompt 中,您可以运行如下一些 powershell 命令:

> $PSVersionTable

Name Value
---- -----
PSVersion 5.1.18362.752
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.752
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

> $env:PATH
C:\Users\user-name\anaconda3;C:\Users\user-name\anaconda3\Library\mingw-w64\bin;...

但是在Anaconda Prompt中,上面的命令不会被识别,你可以运行这个:

>ver

Microsoft Windows [版本 10.0.18363.815]

在幕后,Anaconda Powershell PromptAnaconda Prompt 只是调用不同命令的两个快捷方式:

%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy ByPass -NoExit -Command "& '%USERPROFILE%\anaconda3\shell\condabin\conda-hook.ps1' ; conda activate '%USERPROFILE%\anaconda3' "
%windir%\System32\cmd.exe "/K" %USERPROFILE%\anaconda3\Scripts\activate.bat %USERPROFILE%\anaconda3

enter image description here

关于python - Anaconda Prompt 和 Anaconda Powershell Prompt 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56656493/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com