Python 如何运行康达?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18675907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 11:24:59  来源:igfitidea点击:

How to run Conda?

pythonbashanacondaconda

提问by Ginger

I installed Anaconda and can run Python, so I assume that I installed it correctly. Following this introductory documentation, I am trying to install Python v3.3, so I am copying and pasting the following line into my console:

我安装了 Anaconda 并且可以运行 Python,所以我假设我正确安装了它。按照此介绍性文档,我正在尝试安装 Python v3.3,因此我将以下行复制并粘贴到我的控制台中:

conda create -n py33 python=3.3 anaconda

However, that gives me an error:

但是,这给了我一个错误:

-bash: conda: command not found

-bash: conda: 命令未找到

What do I need to do to run Conda?

我需要做什么才能运行 Conda?

I am working on a Linux system.

我在 Linux 系统上工作。

回答by Ginger

It turns out that I had not set the path.

原来是我没有设置路径。

To do so, I first had to edit .bash_profile (I downloaded it to my local desktop to do that, I do not know how to text edit a file from linux)

为此,我首先必须编辑 .bash_profile (我将其下载到本地桌面来执行此操作,我不知道如何从 linux 文本编辑文件)

Then add this to .bash_profile:

然后将其添加到 .bash_profile:

PATH=$PATH:$HOME/anaconda/bin

回答by yonglin

If you have installed Anaconda but are not able to load the correct versions of python and ipython, or if you see conda: command not found when trying to use conda, this may be an issue with your PATH environment variable. At the prompt, type:

如果您已安装 Anaconda 但无法加载正确版本的 python 和 ipython,或者您在尝试使用 conda 时看到 conda: command not found,这可能是您的 PATH 环境变量的问题。在提示符下,键入:

export PATH=~/anaconda/bin:$PATH

For this example, it is assumed that Anaconda is installed in the default ~/anacondalocation.

对于此示例,假设 Anaconda 安装在默认~/anaconda位置。

回答by user3651854

If you have installed anaconda, but if you are not able to execute conda command from terminal, it means the path is not probably set, try :

如果您已经安装了 anaconda,但是如果您无法从终端执行 conda 命令,这意味着可能没有设置路径,请尝试:

export PATH=~/anaconda/bin:$PATH

See this link.

请参阅此链接

回答by Praneeth

Temporary solution:

临时解决方案:

$anaconda/bin/conda create -n py33 python=3.3 anaconda

回答by madcurie

you might want to try this:

你可能想试试这个:

for anaconda 2 :

对于蟒蛇2:

export PATH=~/anaconda2/bin:$PATH

for anaconda 3 :

对于蟒蛇3:

export PATH=~/anaconda3/bin:$PATH

for anaconda 4 :

对于蟒蛇 4 :

Use the Anaconda Prompt

使用 Anaconda 提示

and then

进而

conda --version

to confirm that it worked. The export PATH=~/anaconda3/bin:$PATHworks but stops when you exit the terminal in order change that you have to run sudo nano ~/.bashrcand then copy the path into the file and save it after that you activate the changes using source .bashrc.

以确认它有效。export PATH=~/anaconda3/bin:$PATH工作但在您退出终端时停止以更改您必须运行sudo nano ~/.bashrc然后将路径复制到文件中并在激活后保存使用source .bashrc 进行更改。

check with conda install anaconda-navigator if not installed follow the anaconda install instructions again

检查 conda install anaconda-navigator 如果未安装,请再次按照 anaconda 安装说明进行操作

follow along with this video https://youtu.be/Pr25JlaXhpc

跟随这个视频 https://youtu.be/Pr25JlaXhpc

回答by Eboi316

This info is current as of today, August 10, 2016. Here are the exact steps I took to fix this using methods posted above. I did not see anyone post: export PATH=$PATH:$HOME/anaconda/bin(you need to add export to the beginning of the line).

此信息是截至今天,即 2016 年 8 月 10 日的最新信息。以下是我使用上面发布的方法修复此问题所采取的确切步骤。我没有看到任何人发帖:(export PATH=$PATH:$HOME/anaconda/bin您需要在行首添加导出)。

Here it is, step-by-step:

在这里,一步一步:

For anyone running into the same problem while using oh-my-zsh, you need to do the following:

对于在使用 oh-my-zsh 时遇到相同问题的任何人,您需要执行以下操作:

-Open your .zshrcin your terminal. I am using iTerm 2and have Sublime Text 3as my default text editor:

-.zshrc在您的终端中打开您的。我正在使用iTerm 2Sublime Text 3作为我的默认文本编辑器:

subl ~/.zshrc

subl ~/.zshrc

-Once the file opens in your text editor, scroll to the very bottom and add:

- 在文本编辑器中打开文件后,滚动到最底部并添加:

export PATH=$PATH:$HOME/anaconda/bin

export PATH=$PATH:$HOME/anaconda/bin

-Save the file, then close it.

- 保存文件,然后关闭它。

-Close your terminal, then relaunch it.

- 关闭您的终端,然后重新启动它。

-Once back in your terminal, type:

- 回到终端后,输入:

conda --v

conda --v

You should then see the version of condainstalled printed on your screen.

然后,您应该会conda在屏幕上看到已安装的版本。



If you're using zsh, then after doing that, your terminal may show you zsh: command not found: rvm-prompt.

如果您使用的是 zsh,那么在此之后,您的终端可能会向您显示zsh: command not found: rvm-prompt.

The solution is:

解决办法是:

  1. add alias rvm-prompt=$HOME/.rvm/bin/rvm-promptwithin .zshrcfile.
  2. type source .zshrc.
  1. alias rvm-prompt=$HOME/.rvm/bin/rvm-prompt.zshrc文件中添加。
  2. 输入source .zshrc.

Then the zsh: command not found: rvm-promptwill disappear.

然后zsh: command not found: rvm-prompt意志消失。

回答by mjp

If you have installed Anaconda and have definitely said yesto the:

如果您已经安装了 Anaconda 并且肯定对以下内容说过yes

Do you wish the installer to prepend the Anaconda install location to PATH in your /home/name/.bashrc ? [yes|no]

question then you maybe just need to restart your terminal window. The change won't take effect until you either (1) close and reopen the current window or (2) just open and start working in a new window

问题那么您可能只需要重新启动终端窗口。在您 (1) 关闭并重新打开当前窗口或 (2) 只是打开并开始在新窗口中工作之前,更改才会生效

Basically, open a new console window and see if it works now.

基本上,打开一个新的控制台窗口,看看它现在是否有效。

回答by Germey

Edit ~/.bash_profile, add this to it.

编辑 ~/.bash_profile,将其添加到其中。

PATH=$PATH:$HOME/anaconda/bin

then run

然后运行

source ~/.bash_profile

Hope can help you.

希望能帮到你。

回答by user278049

In my case conda Path was properly set (in .bashrc) by the conda installation bash. But to make it works I had to give executable file permissions to files in bin sub folder with chmod +x *.

在我的情况下,conda 路径已由 conda 安装 bash 正确设置(在 .bashrc 中)。但是为了使它工作,我必须为 bin 子文件夹中的文件授予可执行文件权限chmod +x *

My system info:

我的系统信息:

conda 4.2.9

康达 4.2.9

Operating System: Debian GNU/Linux 8 (jessie)

操作系统:Debian GNU/Linux 8 (jessie)

Kernel: Linux 3.16.0-4-amd64

内核:Linux 3.16.0-4-amd64

Architecture: x86-64

架构:x86-64

回答by Reihan_amn

Run

cat ~/.bash_profile

to check if anaconda is there. If not you should add its path there. If conda is there copy the entire row that you see the Anaconda there from "export" to the end of line. like this:

检查anaconda是否在那里。如果不是,你应该在那里添加它的路径。如果 conda 在那里,则将您在那里看到 Anaconda 的整行从“导出”复制到行尾。像这样:

export PATH=~/anaconda3/bin:$PATH

Run this in your terminal. Then run

在您的终端中运行它。然后运行

conda --version

to see if it is exported and running!

看看它是否被导出并运行!