标签归档:anaconda

如何激活Anaconda环境

问题:如何激活Anaconda环境

我在Windows 8上,使用Anaconda 1.7.5 64bit。

我创建了一个新的Anaconda环境

conda create -p ./test python=2.7 pip

来自C:\Pr\TEMP\venv\

效果很好(有一个带有新python发行版的文件夹)。康达告诉我输入

activate C:\PR\TEMP\venv\test

激活环境,但是返回:

No environment named "C:\PR\temp\venv\test" exists in C:\PR\Anaconda\envs

如何激活环境?我究竟做错了什么?

I’m on Windows 8, using Anaconda 1.7.5 64bit.

I created a new Anaconda environment with

conda create -p ./test python=2.7 pip

from C:\Pr\TEMP\venv\.

This worked well (there is a folder with a new python distribution). conda tells me to type

activate C:\PR\TEMP\venv\test

to activate the environment, however this returns:

No environment named "C:\PR\temp\venv\test" exists in C:\PR\Anaconda\envs

How can I activate the environment? What am I doing wrong?


回答 0

如果发生这种情况,则需要为您的环境设置PATH(以便从环境和Windows上的Scripts \中获取正确的Python)。

假设您使用以下方法创建了一个名为py33的环境:

conda create -n py33 python=3.3 anaconda

在默认情况下,这里是在Anaconda \ envs中创建的文件夹,因此您需要将PATH设置为:

set PATH=C:\Anaconda\envs\py33\Scripts;C:\Anaconda\envs\py33;%PATH%

现在它应该可以在命令窗口中工作:

activate py33

上面的行是Windows,等同于Mac和Linux教程中通常显示的代码:

$ source activate py33

更多信息:https : //groups.google.com/a/continuum.io/forum/#!topic/ anaconda/ 8T8i11gO39U

anaconda是否为每个新环境创建一个单独的PYTHONPATH变量?

If this happens you would need to set the PATH for your environment (so that it gets the right Python from the environment and Scripts\ on Windows).

Imagine you have created an environment called py33 by using:

conda create -n py33 python=3.3 anaconda

Here the folders are created by default in Anaconda\envs, so you need to set the PATH as:

set PATH=C:\Anaconda\envs\py33\Scripts;C:\Anaconda\envs\py33;%PATH%

Now it should work in the command window:

activate py33

The line above is the Windows equivalent to the code that normally appears in the tutorials for Mac and Linux:

$ source activate py33

More info: https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/8T8i11gO39U

Does `anaconda` create a separate PYTHONPATH variable for each new environment?


回答 1

使用cmd代替Powershell! 我花了2个小时才切换到cmd,然后才起作用!

创建环境:

conda create -n your_environment_name

查看conda环境列表:

conda env list

激活您的环境:

conda activate your_environment_name

那是所有人

Use cmd instead of Powershell! I spent 2 hours before I switched to cmd and then it worked!

create Environment:

conda create -n your_environment_name

see list of conda environments:

conda env list

activate your environment:

conda activate your_environment_name

That’s all folks


回答 2

请注意,用于激活环境的命令在Conda 4.4版中已更改。激活一个环境的推荐的方法是现在conda activate myenv,而不是source activate myenv。要启用新语法,您应该修改 .bashrc文件。该行当前显示类似

export PATH="<path_to_your_conda_install>/bin:$PATH"

应该改为

. <path_to_your_conda_install>/etc/profile.d/conda.sh

这只会将conda命令添加到路径,而尚未激活base环境(以前称为root)。为此,添加另一行

conda activate base

在第一个命令之后。请参阅Anaconda自2017年12月以来的博客文章中的所有详细信息。(我认为该页面目前缺少两行之间的换行符.../conda.shconda activate base)。

(此答案对Linux有效,但对Windows和Mac也可能适用)

Note that the command for activating an environment has changed in Conda version 4.4. The recommended way of activating an environment is now conda activate myenv instead of source activate myenv. To enable the new syntax, you should modify your .bashrc file. The line that currently reads something like

export PATH="<path_to_your_conda_install>/bin:$PATH"

Should be changed to

. <path_to_your_conda_install>/etc/profile.d/conda.sh

This only adds the conda command to the path, but does not yet activate the base environment (which was previously called root). To do also that, add another line

conda activate base

after the first command. See all the details in Anaconda’s blog post from December 2017. (I think that this page is currently missing a newline between the two lines, it says .../conda.shconda activate base).

(This answer is valid for Linux, but it might be relevant for Windows and Mac as well)


回答 3

以前所有的答案似乎都是过时的。

conda activateconda4.4和4.6中引入。

conda activate:重新激活了环境激活的逻辑和机制。与康达4.4,conda activate并且conda deactivate是现在用于激活和停用环境的首选命令。您会发现它们比以前的conda版本中的source activateand source deactivate命令更加灵活。该conda activate命令还具有(1)在所有OS,shell 和平台上通用的优势,以及(2)与其他包(例如python virtualenv的Activate脚本)中的脚本没有路径冲突。

例子

conda create -n venv-name python=3.6
conda activate -n venv-name
conda deactivate

这些新的子命令在“ Aanconda提示”和“ Anaconda Powershell提示”中自动可用。要conda activate每个shell(普通cmd.exe和powershell)中使用,请在Windows的每个shell中检查暴露conda命令

参考资料

All the former answers seem to be outdated.

conda activate was introduced in conda 4.4 and 4.6.

conda activate: The logic and mechanisms underlying environment activation have been reworked. With conda 4.4, conda activate and conda deactivate are now the preferred commands for activating and deactivating environments. You’ll find they are much more snappy than the source activate and source deactivate commands from previous conda versions. The conda activate command also has advantages of (1) being universal across all OSes, shells, and platforms, and (2) not having path collisions with scripts from other packages like python virtualenv’s activate script.

Examples

conda create -n venv-name python=3.6
conda activate -n venv-name
conda deactivate

These new sub-commands are available in “Aanconda Prompt” and “Anaconda Powershell Prompt” automatically. To use conda activate in every shell (normal cmd.exe and powershell), check expose conda command in every shell on Windows.

References


回答 4

从错误消息中可以看到,您指定的路径是错误的。像这样尝试:

activate ..\..\temp\venv\test

但是,当我需要安装Anaconda时,我从这里下载了它并将其安装到默认路径(C:\Anaconda),而不是将此路径放置到环境变量中,因此现在将Anacondas解释器用作默认路径。例如,如果您使用的是PyCharm,则可以在那里直接指定解释器。

As you can see from the error message the paths, that you specified, are wrong. Try it like this:

activate ..\..\temp\venv\test

However, when I needed to install Anaconda, I downloaded it from here and installed it to the default paths (C:\Anaconda), than I put this path to the environment variables, so now Anacondas interpreter is used as default. If you are using PyCharm, for example, you can specify the interpreter there directly.


回答 5

以下是它对我的工作方式

  1. C:\ Windows \ system32>设置CONDA_ENVS_PATH = d:\您的\位置
  2. C:\ Windows \ system32> conda信息

显示新的环境路径

  1. C:\ Windows \ system32> conda创建-n YourNewEnvironment –clone = root

克隆默认的根环境

  1. C:\ Windows \ system32>激活YourNewEnvironment

停用环境“ d:\ YourDefaultAnaconda3” …停用环境“ d:\ your \ location \ YourNewEnvironment” …

  1. [YourNewEnvironment] C:\ Windows \ system32> conda信息-e

康达环境:

YourNewEnvironment
* d:\ your \ location \ YourNewEnvironment

根d:\ YourDefaultAnaconda3

Below is how it worked for me

  1. C:\Windows\system32>set CONDA_ENVS_PATH=d:\your\location
  2. C:\Windows\system32>conda info

Shows new environment path

  1. C:\Windows\system32>conda create -n YourNewEnvironment –clone=root

Clones default root environment

  1. C:\Windows\system32>activate YourNewEnvironment

Deactivating environment “d:\YourDefaultAnaconda3″… Activating environment “d:\your\location\YourNewEnvironment”…

  1. [YourNewEnvironment] C:\Windows\system32>conda info -e

conda environments: #

YourNewEnvironment
* d:\your\location\YourNewEnvironment

root d:\YourDefaultAnaconda3


回答 6

我曾尝试用Jenkins job(bash)激活env conda activate base ,但是失败了,所以在尝试了很多之后,这个对我有用(CentOS 7):

source /opt/anaconda2/bin/activate base

I’ve tried to activate env from Jenkins job (in bash) with conda activate base and it failed, so after many tries, this one worked for me (CentOS 7) :

source /opt/anaconda2/bin/activate base

回答 7

假设您的环境名称为‘demo’,并且您正在使用anaconda并想创建一个虚拟环境:

(如果您想要python3)

    conda create -n demo python=3

(如果您想要python2)

    conda create -n demo python=2

运行上述命令后,您必须通过以下命令激活环境:

    source activate demo 

let’s assume your environment name is ‘demo’ and you are using anaconda and want to create a virtual environment:

(if you want python3)

    conda create -n demo python=3

(if you want python2)

    conda create -n demo python=2

After running above command you have to activate the environment by bellow command:

    source activate demo 

回答 8

对我来说,使用Anaconda Prompt代替cmd或PowerShell是关键。

在Anaconda Prompt中,我要做的就是 activate XXX

For me, using Anaconda Prompt instead of cmd or PowerShell is the key.

In Anaconda Prompt, all I need to do is activate XXX


回答 9

我也有相同的想法,似乎已在源代码中进行了修复。

I was having the same, a fix seems to have been made in the source.


回答 10

正如@Simba正确回答的那样,自4.6起conda env发生了变化。Conda activate (env-name)彻底推翻source activate (env-name),但并非没有挑战。conda activate经常强迫你的环境建立基础,让你看到类似的东西。因此,将大量错误抛给您。这也可能是因为auto_activate_base设置为True。

您可以使用以下命令进行检查

conda config --set auto_activate_base False

source ~/.bashrc

要重新激活使用此

conda config --set auto_activate_base True

source ~/.bashrc

just as @Simba has rightly answered alot has changed in the conda env since 4.6. Conda activate (env-name) overthrew source activate (env-name) for good but not without it own challenges. conda activate oftentimes force your environment to base and make u see something like . Therefore throwing loads of error back at you. This can also be because auto_activate_base is set to True.

You can check this by using the following command

conda config --set auto_activate_base False

source ~/.bashrc.

And To reactivate use this

conda config --set auto_activate_base True

source ~/.bashrc


回答 11

窗口: conda激活environment_name

Mac:conda激活environment_name

Window: conda activate environment_name

Mac: conda activate environment_name


如何在Anaconda(Conda)环境中跟踪点子安装的软件包?

问题:如何在Anaconda(Conda)环境中跟踪点子安装的软件包?

我已经安装并一直在使用Anaconda Python发行版,并且已经开始使用Anaconda(Conda)环境。我可以使用标准conda install...命令将分发包中的软件包放入我的环境中,但要使用其他pip install在活动环境中需要使用的东西(例如Flask-WTF,flask-sqlalchemy和alembic)。但是,当我查看环境的内容时,无论是在目录中还是使用conda list这些pip installed包,都不会显示。

使用pip freezepip list仅列出我曾经安装的每个软件包。

有没有办法跟踪我的每个Anaconda env(安装pipconda安装的)中的物品?

I’ve installed and have been using the Anaconda Python distribution, and I have started using the Anaconda (Conda) environment. I can use the standard conda install... command to put packages from the distribution into my environments, but to use anything outside (i.e. Flask-WTF, flask-sqlalchemy, and alembic) I need to use pip install in the active environment. However, when I look at the contents of the environment, either in the directory, or using conda list these pip installed packages don’t show up.

Using pip freeze and pip list just lists every package I’ve ever installed.

Is there a way to keep track of what is in each of my Anaconda envs (both pip and conda installed)?


回答 0

conda-env现在可以自动执行此操作(如果pip与conda一起安装)。

您可以使用用于迁移环境的导出工具来查看其工作原理:

conda env export -n <env-name> > environment.yml

该文件将列出conda软件包和pip软件包:

name: stats
channels:
  - javascript
dependencies:
  - python=3.4
  - bokeh=0.9.2
  - numpy=1.9.*
  - nodejs=0.10.*
  - flask
  - pip:
    - Flask-Testing

如果您希望继续导出环境,请移至environment.yml新的主机并运行:

conda env create -f path/to/environment.yml

conda-env now does this automatically (if pip was installed with conda).

You can see how this works by using the export tool used for migrating an environment:

conda env export -n <env-name> > environment.yml

The file will list both conda packages and pip packages:

name: stats
channels:
  - javascript
dependencies:
  - python=3.4
  - bokeh=0.9.2
  - numpy=1.9.*
  - nodejs=0.10.*
  - flask
  - pip:
    - Flask-Testing

If you’re looking to follow through with exporting the environment, move environment.yml to the new host machine and run:

conda env create -f path/to/environment.yml

回答 1

conda将仅跟踪其安装的软件包。并pip会为您提供使用pip安装程序本身安装的软件包,或setuptoolssetup.pyconda构建中使用的软件包生成的egg信息。因此,您基本上有三个选择。

  1. 你可以采取的联合conda listpip freeze和管理使用安装的软件包conda(在这个节目conda list用)conda包管理器,并确保安装与个位pip(即秀pip freeze,但不是在conda list)与pip

  2. 仅在和环境中安装pythonpip然后使用distribute打包和管理所有内容pip。(如果您使用的是Windows,那么这并不是一件容易的事…)

  3. 构建自己的conda软件包,并使用进行管理conda

我个人推荐第三个选项,因为它很容易构建conda软件包。在连续体的github帐户上有一个示例食谱的git存储库。但通常可以归结为:

 conda skeleton pypi PACKAGE
 conda build PACKAGE

要不就:

conda pipbuild PACKAGE

同样,一旦构建它们,您就可以将它们上传到https://binstar.org/并从那里安装。

然后,您将使用进行所有管理conda

conda will only keep track of the packages it installed. And pip will give you the packages that were either installed using the pip installer itself or they used setuptools in their setup.py so conda build generated the egg information. So you have basically three options.

  1. You can take the union of the conda list and pip freeze and manage packages that were installed using conda (that show in the conda list) with the conda package manager and the ones that are installed with pip (that show in pip freeze but not in conda list) with pip.

  2. Install in your environment only the python, pip and distribute packages and manage everything with pip. (This is not that trivial if you’re on Windows…)

  3. Build your own conda packages, and manage everything with conda.

I would personally recommend the third option since it’s very easy to build conda packages. There is a git repository of example recipes on the continuum’s github account. But it usually boils down to:

 conda skeleton pypi PACKAGE
 conda build PACKAGE

or just:

conda pipbuild PACKAGE

Also when you have built them once, you can upload them to https://binstar.org/ and just install from there.

Then you’ll have everything managed using conda.


回答 2

有一个conda(new-pypi-install)分支,它可以更好地与pip和PyPI集成。特别是conda列表还将显示pip安装的软件包,conda安装将首先尝试查找conda软件包,如果失败,将使用pip安装软件包。

该分支计划于本周晚些时候合并,以便conda 2.1版将更好地与conda进行点集成。

There is a branch of conda (new-pypi-install) that adds better integration with pip and PyPI. In particular conda list will also show pip installed packages and conda install will first try to find a conda package and failing that will use pip to install the package.

This branch is scheduled to be merged later this week so that version 2.1 of conda will have better pip-integration with conda.


回答 3

我遵循@Viktor Kerkez的回答,并取得了不同的成功。我发现有时候这个食谱

康达骨架pypi包装

康达构建包

看起来一切正常,但我无法成功导入PACKAGE。最近,我在Anaconda用户组上询问了此问题,并从@Travis Oliphant自己那里听说了使用conda构建和管理Anaconda附带的软件包的最佳方法。您可以在此处阅读此主题,但我将在下面描述该方法,以期使OP的问题的答案更加完整…

示例:我将使用conda 2.2.5在Windows上安装出色的prettyplotlib软件包

1a) conda build --build-recipe prettyplotlib

在构建的最后“测试”部分之前,您将看到构建消息看起来都不错。我看到了这个错误

文件“ C:\ Anaconda \ conda-bld \ test-tmp_dir \ run_test.py”,第23行导入None语法错误:无法分配为None测试失败:prettyplotlib-0.1.3-py27_0

1b)进入/ conda-recipes / prettyplotlib并编辑meta.yaml文件。当前,像在步骤1a中一样设置的软件包会导致yaml文件在该test部分中出错。例如,这是我的寻找方式prettyplotlib

test:   # Python imports   imports:
    - 
    - prettyplotlib
    - prettyplotlib

编辑此部分以删除-开头的空白行,并删除多余的prettyplotlib行。在撰写本文时,我发现我需要为使用conda安装的外部软件包编辑这样的大多数meta.yaml文件,这意味着有空白的导入行会导致错误以及给定软件包的冗余导入。

1c)从1a重新运行命令,这一次应该正确完成。在构建结束时,系统会询问您是否要将构建上传到binstar。我输入“否”,然后看到以下消息:

如果您想稍后将此包上传到binstar.org,请键入:

$ binstar上传C:\ Anaconda \ conda-bld \ win-64 \ prettyplotlib-0.1.3-py27_0.tar.bz2

该tar.bz2文件是您现在实际需要安装的构建。

2) conda install C:\Anaconda\conda-bld\win-64\prettyplotlib-0.1.3-py27_0.tar.bz2

按照这些步骤,我已经成功地使用conda安装了Anaconda随附的许多软件包。以前,我已经使用pip安装了其中的一些工具,因此pip uninstall PACKAGE在使用conda安装PACKAGE之前,我已经完成了安装。使用conda,我现在可以通过一种方法来管理(几乎)所有软件包,而无需将conda,pip,easy_install和python setup.py安装混合在一起。

对于上下文,我认为@Travis Oliphant的最新博客文章将对像我这样的人有所帮助,他们不喜欢使用健壮的Python包装的所有内容,但可以肯定当东西“起作用时”。康达似乎是前进的好方法…

I followed @Viktor Kerkez’s answer and have had mixed success. I found that sometimes this recipe of

conda skeleton pypi PACKAGE

conda build PACKAGE

would look like everything worked but I could not successfully import PACKAGE. Recently I asked about this on the Anaconda user group and heard from @Travis Oliphant himself on the best way to use conda to build and manage packages that do not ship with Anaconda. You can read this thread here, but I’ll describe the approach below to hopefully make the answers to the OP’s question more complete…

Example: I am going to install the excellent prettyplotlib package on Windows using conda 2.2.5.

1a) conda build --build-recipe prettyplotlib

You’ll see the build messages all look good until the final TEST section of the build. I saw this error

File “C:\Anaconda\conda-bld\test-tmp_dir\run_test.py”, line 23 import None SyntaxError: cannot assign to None TESTS FAILED: prettyplotlib-0.1.3-py27_0

1b) Go into /conda-recipes/prettyplotlib and edit the meta.yaml file. Presently, the packages being set up like in step 1a result in yaml files that have an error in the test section. For example, here is how mine looked for prettyplotlib

test:   # Python imports   imports:
    - 
    - prettyplotlib
    - prettyplotlib

Edit this section to remove the blank line preceded by the – and also remove the redundant prettyplotlib line. At the time of this writing I have found that I need to edit most meta.yaml files like this for external packages I am installing with conda, meaning that there is a blank import line causing the error along with a redundant import of the given package.

1c) Rerun the command from 1a, which should complete with out error this time. At the end of the build you’ll be asked if you want to upload the build to binstar. I entered No and then saw this message:

If you want to upload this package to binstar.org later, type:

$ binstar upload C:\Anaconda\conda-bld\win-64\prettyplotlib-0.1.3-py27_0.tar.bz2

That tar.bz2 file is the build that you now need to actually install.

2) conda install C:\Anaconda\conda-bld\win-64\prettyplotlib-0.1.3-py27_0.tar.bz2

Following these steps I have successfully used conda to install a number of packages that do not come with Anaconda. Previously, I had installed some of these using pip, so I did pip uninstall PACKAGE prior to installing PACKAGE with conda. Using conda, I can now manage (almost) all of my packages with a single approach rather than having a mix of stuff installed with conda, pip, easy_install, and python setup.py install.

For context, I think this recent blog post by @Travis Oliphant will be helpful for people like me who do not appreciate everything that goes into robust Python packaging but certainly appreciate when stuff “just works”. conda seems like a great way forward…


回答 4

这就是为什么我写Picky的原因:http : //picky.readthedocs.io/

这是一个python软件包,可跟踪在virtualenvs和conda envs中随pip或conda安装的软件包。

This is why I wrote Picky: http://picky.readthedocs.io/

It’s a python package that tracks packages installed with either pip or conda in either virtualenvs and conda envs.


回答 5

我认为这里缺少的是:

>pip install .

要使用setup.py安装本地软件包,它将安装一个对使用相同版本 python的所有 conda env 可见的软件包。注意我正在使用conda版本的pip!

例如,如果我使用的是python2.7,它将本地包放在此处:

/usr/local/anaconda/lib/python2.7/site-packages

如果以后再用python = 2.7(=默认值)创建一个新的conda env:

>conda create --name new

>source activate new

然后执行:

(new)>conda list    // empty - conda is not aware of any packages yet

但是,如果我这样做:

(new)>pip list      // the local package installed above is present

因此,在这种情况下,conda不了解pip包,但是python可以使用该包。

但是,如果我不是安装在本地包(再次使用PIP)后,我已经创建(激活)新康达ENV,现在畅达看到它:

(new)>conda list   // sees that the package is there and was installed by pip

因此,我认为conda和pip之间的交互存在一些问题-即,使用pip从一个conda env中安装本地软件包会使该软件包可用于同一python版本的所有其他conda env(但不能通过conda列表看到)。

I think what’s missing here is that when you do:

>pip install .

to install a local package with a setup.py, it installs a package that is visible to all the conda envs that use the same version of python. Note I am using the conda version of pip!

e.g., if I’m using python2.7 it puts the local package here:

/usr/local/anaconda/lib/python2.7/site-packages

If I then later create a new conda env with python=2.7 (= the default):

>conda create --name new

>source activate new

And then do:

(new)>conda list    // empty - conda is not aware of any packages yet

However, if I do:

(new)>pip list      // the local package installed above is present

So in this case, conda does not know about the pip package, but the package is available to python.

However, If I instead install the local package (again using pip) after I’ve created (and activated) the new conda env, now conda sees it:

(new)>conda list   // sees that the package is there and was installed by pip

So I think the interaction between conda and pip has some issues – ie, using pip to install a local package from within one conda env makes that package available (but not seen via conda list) to all other conda envs of the same python version.


回答 6

conda env export列出环境中的所有conda和pip软件包。conda-env必须安装在conda根目录(conda install -c conda conda-env)中。

编写environment.yml描述当前环境的文件:

conda env export > environment.yml

参考文献:

conda env export lists all conda and pip packages in an environment. conda-env must be installed in the conda root (conda install -c conda conda-env).

To write an environment.yml file describing the current environment:

conda env export > environment.yml

References:


回答 7

我通常会在“ pip”命令之前为要安装软件包的特定环境添加“ bin / pip”文件夹前缀。例如,如果要在环境py34中安装pymc3,则应使用以下命令:

~/anaconda/envs/py34/bin/pip install git+https://github.com/pymc-devs/pymc3 

基本上,您只需要找到环境“ bin / pip”文件夹的正确路径,并将其放在install命令之前即可。

I usually prefix the ‘bin/pip’ folder for the specific environment you want to install the package before the ‘pip’ command. For instance, if you would like to install pymc3 in the environment py34, you should use this command:

~/anaconda/envs/py34/bin/pip install git+https://github.com/pymc-devs/pymc3 

You basically just need to find the right path to your environment ‘bin/pip’ folder and put it before the install command.


回答 8

which pip显示了以下路径:

$ which pip
/home/kmario23/anaconda3/bin/pip

因此,pip install <package-name>使用以下命令导出列表时,无论我安装使用的任何软件包,都必须反映在软件包列表中:

$ conda list --export > conda_list.txt

但是,我没有。因此,我改用了其他一些人建议的以下命令:

# get environment name by
$ conda-env list

# get list of all installed packages by (conda, pip, etc.,)
$ conda-env export -n <my-environment-name> > all_packages.yml
# if you haven't created any specific env, then just use 'root'

现在,我可以看到all-packages.yml文件中的所有软件包。

My which pip shows the following path:

$ which pip
/home/kmario23/anaconda3/bin/pip

So, whatever package I install using pip install <package-name> will have to be reflected in the list of packages when the list is exported using:

$ conda list --export > conda_list.txt

But, I don’t. So, instead I used the following command as suggested by several others:

# get environment name by
$ conda-env list

# get list of all installed packages by (conda, pip, etc.,)
$ conda-env export -n <my-environment-name> > all_packages.yml
# if you haven't created any specific env, then just use 'root'

Now, I can see all the packages in my all-packages.yml file.


回答 9

您可以先在conda环境中安装以下给定命令开始:

conda install pip

然后安装环境中所需的所有pip软件包。

安装所有conda和pip软件包以导出环境后,请使用:

conda env export -n <env-name> > environment.yml

这将在文件夹中创建所需的文件

You can start by installing the below given command in the conda environment:

conda install pip

Followed by installing all pip packages you need in the environment.

After installing all the conda and pip packages to export the environment use:

conda env export -n <env-name> > environment.yml

This will create the required file in the folder


pyenv,virtualenv,anaconda有什么区别?

问题:pyenv,virtualenv,anaconda有什么区别?

我是一个尝试学习python的红宝石程序员。我很喜欢pyenv,因为它就像来自rbenv的复制和粘贴一样。Pyenv帮助在系统中拥有多个版本的python,并且无需隔离系统的敏感部分即可隔离python。

我想每个python安装都带有pip包。我仍然不明白的是,有很多好的python库建议使用此virtualenv和anaconda。我什至可以找到pyenv的virtualenv插件。

现在,我对这两个pyenv和virtualenv的目的感到困惑。更糟糕的是在pyenv内部有一个virtualenv插件。

我的问题是:

  • pyenv和virtualenv有什么区别?
  • 在pyenv和virtualenv中使用pip命令有什么区别吗?
  • pyenv virutalenv做什么?

您的示例解释将不胜感激。

I am a ruby programmer trying to learn python. I am pretty family with pyenv since it is like a copy and paste from rbenv. Pyenv helps allow to have more than one version of python in a system and also to isolate the python without touching sensitive part of system.

I suppose every python installation come with pip package. What I still don’t understand is, there are many good python libs out there that suggest to use this virtualenv and anaconda. I can even find virtualenv plugin for pyenv.

Now I am getting confused with the purpose of these two pyenv and virtualenv. worse inside pyenv there is a virtualenv plugin.

my questions are:

  • what is the difference between pyenv and virtualenv?
  • Is there any difference in using pip command inside both pyenv and virtualenv?
  • what does this pyenv virutalenv do?

your explanation with example will be highly appreciated.


回答 0

编辑:pip这里也值得一提,conda并且pip具有与该主题相关的异同

pip:Python软件包管理器。

  • 您可能将其pip视为ruby gem命令的python等效项
  • pip 默认情况下不包含在python中。
  • 您可以使用homebrew安装Python ,它将自动安装pip:brew install python
  • OSX的最终版本默认不包含pip。要将pip添加到Mac系统的python版本中,您可以sudo easy_install pip
  • 您可以使用PyPI查找和发布python软件包:Python软件包索引
  • requirements.txt文件与ruby相当 gemfile
  • 要创建需求文本文件, pip freeze > requirements.txt
  • 请注意,此时,我们已经在系统上安装了python,并创建了requirements.txt文件,该文件概述了系统上已安装的所有python软件包。

pyenv:Python版本管理器

  • 从文档 pyenv可以轻松在多个版本的Python之间切换。它简单,简单,遵循UNIX的一站式工具的传统,可以很好地完成一件事。该项目是从rbenv和ruby-build分叉的,并针对Python进行了修改。
  • 很多人 不愿使用python3
  • 如果您需要使用其他版本的python,则pyenv可以轻松进行管理。

virtualenv:Python环境管理器。

  • 从文档要解决的基本问题是依赖项和版本之一以及间接权限。假设您有一个需要使用LibFoo版本1的应用程序,但是另一个应用程序需要版本2。如果将所有内容都安装到/usr/lib/python2.7/site-packages(或平台的标准位置是什么)中,那么很容易在无意中升级不应升级的应用程序的情况下结束。
  • 要创建一个virtualenv,只需调用virtualenv ENV,其中ENV是用于放置新虚拟环境的目录。
  • 要初始化virtualenv,您需要source ENV/bin/activate。要停止使用,只需调用deactivate
  • 激活后virtualenv,您可以通过运行pip install -r项目requirements.txt文件来安装工作区的所有软件包要求。

Anaconda:程序包经理+环境经理+其他科学图书馆。

  • 来自文档Anaconda 4.2.0包括易于安装的Python(2.7.12、3.4.5和/或3.5.2),以及100多种经过预先构建和测试的科学和分析Python软件包的更新,其中包括NumPy,Pandas ,SciPy,Matplotlib和IPython,通过一个简单的工具即可提供620多个软件包conda install <packagename>
  • 作为Web开发人员,我没有使用Anaconda。包括所有程序包,容量约为3GB。
  • 有一个精简miniconda版,似乎比使用pip+ 更简单virtualenv,尽管我个人没有使用它的经验。
  • 尽管conda允许您安装软件包,但是这些软件包与PyPI软件包是分开的,因此,根据您需要安装的软件包的类型,您可能仍然需要额外使用pip。

也可以看看:

Edit: It’s worth mentioning pip here as well, as conda and pip have similarities and differences that are relevant to this topic.

pip: the Python Package Manager.

  • You might think of pip as the python equivalent of the ruby gem command
  • pip is not included with python by default.
  • You may install Python using homebrew, which will install pip automatically: brew install python
  • The final version of OSX did not include pip by default. To add pip to your mac system’s version of python, you can sudo easy_install pip
  • You can find and publish python packages using PyPI: The Python Package Index
  • The requirements.txt file is comparable to the ruby gemfile
  • To create a requirements text file, pip freeze > requirements.txt
  • Note, at this point, we have python installed on our system, and we have created a requirements.txt file that outlines all of the python packages that have been installed on your system.

pyenv: Python Version Manager

  • From the docs: pyenv lets you easily switch between multiple versions of Python. It’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well. This project was forked from rbenv and ruby-build, and modified for Python.
  • Many folks hesitate to use python3.
  • If you need to use different versions of python, pyenv lets you manage this easily.

virtualenv: Python Environment Manager.

  • From the docs: The basic problem being addressed is one of dependencies and versions, and indirectly permissions. Imagine you have an application that needs version 1 of LibFoo, but another application requires version 2. How can you use both these applications? If you install everything into /usr/lib/python2.7/site-packages (or whatever your platform’s standard location is), it’s easy to end up in a situation where you unintentionally upgrade an application that shouldn’t be upgraded.
  • To create a virtualenv, simply invoke virtualenv ENV, where ENV is is a directory to place the new virtual environment.
  • To initialize the virtualenv, you need to source ENV/bin/activate. To stop using, simply call deactivate.
  • Once you activate the virtualenv, you might install all of a workspace’s package requirements by running pip install -r against the project’s requirements.txt file.

Anaconda: Package Manager + Environment Manager + Additional Scientific Libraries.

  • From the docs: Anaconda 4.2.0 includes an easy installation of Python (2.7.12, 3.4.5, and/or 3.5.2) and updates of over 100 pre-built and tested scientific and analytic Python packages that include NumPy, Pandas, SciPy, Matplotlib, and IPython, with over 620 more packages available via a simple conda install <packagename>
  • As a web developer, I haven’t used Anaconda. It’s ~3GB including all the packages.
  • There is a slimmed down miniconda version, which seems like it could be a more simple option than using pip + virtualenv, although I don’t have experience using it personally.
  • While conda allows you to install packages, these packages are separate than PyPI packages, so you may still need to use pip additionally depending on the types of packages you need to install.

See also:


回答 1

简单类比:

  • pyenv〜rbenv
  • 点〜捆绑器
  • 虚拟环境〜rvm中的gemset。可以由捆绑器直接管理,而无需使用gemset。

由于我使用python3,因此我更喜欢名为venv的python3内置虚拟环境。venv简单易用。我建议您阅读其官方文档。该文档简短明了。

在ruby中,我们实际上并不需要虚拟环境,因为捆绑程序会处理它。虚拟环境和捆绑程序都很棒,但是它们的概念不同,但是它们试图解决相同的问题。

Simple analogy:

  • pyenv ~ rbenv
  • pip ~ bundler
  • virtual env ~ gemset in rvm. This can be managed by bundler directly without gemset.

Since I use python3 I prefer the python3 built-in virtual environment named venv. venv is simple and easy to use. I would recommend you to read its official docs. The doc is short and concise.

In ruby, we don’t really need a virtual environment because the bundler takes care of it. Both virtual env and bundler are great, however, they have different solutions to solve the same problem.


使用Conda进行批量包装更新

问题:使用Conda进行批量包装更新

有没有一种方法(使用conda更新),我可以列出过时的软件包并选择或批量更新Anaconda中的软件包(兼容)?

单独更新软件包没有太大意义,因为有数百个软件包。

Is there a way (using conda update) that I can list outdated packages and select or bulk update (compatible) packages in Anaconda?

It doesn’t make much sense updating the packages individually as there are hundreds of them.


回答 0

你要conda update --all

conda search --outdated将显示过时的软件包并对其conda update --all进行更新(请注意,后者不会将您从Python 2更新到Python 3,但如果您使用Python 2,前者将显示Python已过时)。

You want conda update --all.

conda search --outdated will show outdated packages, and conda update --all will update them (note that the latter will not update you from Python 2 to Python 3, but the former will show Python as being outdated if you do use Python 2).


回答 1

在继续执行conda update --all命令之前,conda update conda如果很长时间没有更新conda,请先使用command更新它。它发生在我身上(Anaconda 64位上的Python 2.7.13)。

Before you proceed to conda update --all command, first update conda with conda update conda command if you haven’t update it for a long time. It happent to me (Python 2.7.13 on Anaconda 64 bits).


回答 2

Conda Package Manager几乎已准备好进行Beta测试,但直到Spyder 2.4(https://github.com/spyder-ide/spyder/wiki/Roadmap)发行后,才能完全集成。准备好进行测试后,我们会在邮件列表(https://groups.google.com/forum/#!forum/spyderlib)上发布一些内容。请务必订阅

干杯!

the Conda Package Manager is almost ready for beta testing, but it will not be fully integrated until the release of Spyder 2.4 (https://github.com/spyder-ide/spyder/wiki/Roadmap). As soon as we have it ready for testing we will post something on the mailing list (https://groups.google.com/forum/#!forum/spyderlib). Be sure to subscribe

Cheers!


回答 3

# list packages that can be updated
conda search --outdated

# update all packages prompted(by asking the user yes/no)
conda update --all

# update all packages unprompted
conda update --all -y
# list packages that can be updated
conda search --outdated

# update all packages prompted(by asking the user yes/no)
conda update --all

# update all packages unprompted
conda update --all -y

康达能否取代对virtualenv的需求?

问题:康达能否取代对virtualenv的需求?

我在安装SciPy时遇到了麻烦,最近发现了Conda,特别是在我正在开发的Heroku应用程序上。

使用Conda,您可以创建与virtualenv十分相似的环境。我的问题是:

  1. 如果我使用Conda,它将取代对virtualenv的需求吗?如果没有,如何将两者一起使用?是否在Conda中安装virtualenv或在virtualenv中安装Conda?
  2. 我还需要使用点子吗?如果是这样,我仍然可以在隔离的环境中使用pip安装软件包吗?

I recently discovered Conda after I was having trouble installing SciPy, specifically on a Heroku app that I am developing.

With Conda you create environments, very similar to what virtualenv does. My questions are:

  1. If I use Conda will it replace the need for virtualenv? If not, how do I use the two together? Do I install virtualenv in Conda, or Conda in virtualenv?
  2. Do I still need to use pip? If so, will I still be able to install packages with pip in an isolated environment?

回答 0

  1. 康达取代了virtualenv。我认为这更好。它不仅限于Python,还可以用于其他语言。以我的经验,它提供了更加流畅的体验,尤其是对于科学包装。我第一次在Mac上正确安装MayaVi是使用conda

  2. 您仍然可以使用pip。实际上,conda安装pip在每个新环境中。它知道有关pip安装的软件包的信息。

例如:

conda list

列出当前环境中所有已安装的软件包。Conda安装的软件包显示如下:

sphinx_rtd_theme          0.1.7                    py35_0    defaults

并通过安装的pip带有<pip>标记:

wxpython-common           3.0.0.0                   <pip>
  1. Conda replaces virtualenv. In my opinion it is better. It is not limited to Python but can be used for other languages too. In my experience it provides a much smoother experience, especially for scientific packages. The first time I got MayaVi properly installed on Mac was with conda.

  2. You can still use pip. In fact, conda installs pip in each new environment. It knows about pip-installed packages.

For example:

conda list

lists all installed packages in your current environment. Conda-installed packages show up like this:

sphinx_rtd_theme          0.1.7                    py35_0    defaults

and the ones installed via pip have the <pip> marker:

wxpython-common           3.0.0.0                   <pip>

回答 1

简短的答案是,您只需要conda。

  1. Conda在单个软件包中有效地结合了pip和virtualenv的功能,因此,如果您使用的是conda,则不需要virtualenv。

  2. 您会惊讶conda支持多少个软件包。如果还不够,可以在conda下使用pip。

这是到conda页面的链接,用于比较conda,pip和virtualenv:

https://docs.conda.io/projects/conda/zh-CN/latest/commands.html#conda-vs-pip-vs-virtualenv-commands

Short answer is, you only need conda.

  1. Conda effectively combines the functionality of pip and virtualenv in a single package, so you do not need virtualenv if you are using conda.

  2. You would be surprised how many packages conda supports. If it is not enough, you can use pip under conda.

Here is a link to the conda page comparing conda, pip and virtualenv:

https://docs.conda.io/projects/conda/en/latest/commands.html#conda-vs-pip-vs-virtualenv-commands.


回答 2

虚拟环境和 pip

我会补充说,使用Anaconda可以轻松创建删除 conda环境。

> conda create --name <envname> python=<version> <optional dependencies>

> conda remove --name <envname> --all 

激活的环境中,通过conda或安装软件包pip

(envname)> conda install <package>

(envname)> pip install <package>

这些环境与conda的pip式软件包管理紧密相关,因此创建环境以及安装Python和非Python软件包都很简单。


朱皮特

此外,在环境中安装ipykernel在Jupyter笔记本的“内核”下拉菜单中会添加一个新列表,从而将可复制的环境扩展到笔记本。从Anaconda 4.1开始,添加了nbextensions,更轻松地为笔记本添加了扩展名。

可靠性

以我的经验,conda在安装大型库(例如numpy和)时更快,更可靠pandas。此外,如果您希望转移环境的保留状态,则可以通过共享克隆环境来实现。

Virtual Environments and pip

I will add that creating and removing conda environments is simple with Anaconda.

> conda create --name <envname> python=<version> <optional dependencies>

> conda remove --name <envname> --all 

In an activated environment, install packages via conda or pip:

(envname)> conda install <package>

(envname)> pip install <package>

These environments are strongly tied to conda’s pip-like package management, so it is simple to create environments and install both Python and non-Python packages.


Jupyter

In addition, installing ipykernel in an environment adds a new listing in the Kernels dropdown menu of Jupyter notebooks, extending reproducible environments to notebooks. As of Anaconda 4.1, nbextensions were added, adding extensions to notebooks more easily.

Reliability

In my experience, conda is faster and more reliable at installing large libraries such as numpy and pandas. Moreover, if you wish to transfer your the preserved state of an environment, you can do so by sharing or cloning an env.


回答 3

安装Conda将使您能够根据需要创建和删除python环境,从而为您提供与virtualenv相同的功能。

对于这两种发行版,您将能够创建一个隔离的文件系统树,在其中您可以根据需要安装和删除python软件包(可能是pip)。如果您想为不同的用例使用同一个库的不同版本,或者只想尝试进行一些发行并将其删除以节省磁盘空间,则可能会派上用场。

差异:

许可协议。虽然virtualenv已获得MIT最宽松的许可证,但Conda使用3条款BSD许可。

康达为您提供了自己的包装控制系统。这个程序包控制系统通常提供流行的非python软件的预编译版本(对于大多数流行的系统),这可以很容易地使某些机器学习程序包正常工作。也就是说,您不必为系统编译优化的C / C ++代码。虽然这对我们大多数人来说是一个很大的缓解,但它可能会影响此类库的性能。

与virtualenv不同,Conda至少在Linux系统上复制了一些系统库。该库可能不同步,从而导致程序行为不一致。

判决:

Conda很棒,应该是您开始机器学习之路的默认选择。它将为您节省一些时间,使他们无法使用gcc和许多软件包。但是,Conda并没有取代virtualenv。它引入了一些额外的复杂性,而这些复杂性可能并非总是需要的。它具有不同的许可。您可能要避免在分布式环境或HPC硬件上使用conda。

Installing Conda will enable you to create and remove python environments as you wish, therefore providing you with same functionality as virtualenv would.

In case of both distributions you would be able to create an isolated filesystem tree, where you can install and remove python packages (probably, with pip) as you wish. Which might come in handy if you want to have different versions of same library for different use cases or you just want to try some distribution and remove it afterwards conserving your disk space.

Differences:

License agreement. While virtualenv comes under most liberal MIT license, Conda uses 3 clause BSD license.

Conda provides you with their own package control system. This package control system often provides precompiled versions (for most popular systems) of popular non-python software, which can easy ones way getting some machine learning packages working. Namely you don’t have to compile optimized C/C++ code for you system. While it is a great relief for most of us, it might affect performance of such libraries.

Unlike virtualenv, Conda duplicating some system libraries at least on Linux system. This libraries can get out of sync leading to inconsistent behavior of your programs.

Verdict:

Conda is great and should be your default choice while starting your way with machine learning. It will save you some time messing with gcc and numerous packages. Yet, Conda does not replace virtualenv. It introduces some additional complexity which might not always be desired. It comes under different license. You might want to avoid using conda on a distributed environments or on HPC hardware.


回答 4

我同时使用和(截至2020年1月)它们具有一些肤浅的差异,因此适合我的不同用法。通过默认康达更喜欢在一个中央位置来管理你的环境的列表,而使得的virtualenv在当前目录中的文件夹。前者(集中式)在您进行机器学习时才有意义,例如,您有几个广泛的环境可用于许多项目,并且想从任何地方跳入其中。如果您正在做一些一次性项目,这些项目具有完全不同的lib需求集,而lib需求集实际上更多地属于项目本身,则后者(每个项目文件夹)才有意义。

Conda创建的空环境约为122MB,而virtualenv约为12MB,因此,这是您可能不希望将Conda环境分散在各处的另一个原因。

最后,表明Conda偏爱其集中式env的另一个表面现象是(同样,默认情况下),如果您确实在自己的项目文件夹中创建了一个Conda env并激活它,则出现在外壳中的名称前缀是(太长)绝对值文件夹的路径。您可以通过给它命名来解决该问题,但是virtualenv默认情况下做对了。

我希望随着两个程序包管理者争夺霸主地位,此信息会迅速过时,但这是今天的权衡:)

I use both and (as of Jan, 2020) they have some superficial differences that lend themselves to different usages for me. By default Conda prefers to manage a list of environments for you in a central location, whereas virtualenv makes a folder in the current directory. The former (centralized) makes sense if you are e.g. doing machine learning and just have a couple of broad environments that you use across many projects and want to jump into them from anywhere. The latter (per project folder) makes sense if you are doing little one-off projects that have completely different sets of lib requirements that really belong more to the project itself.

The empty environment that Conda creates is about 122MB whereas the virtualenv’s is about 12MB, so that’s another reason you may prefer not to scatter Conda environments around everywhere.

Finally, another superficial indication that Conda prefers its centralized envs is that (again, by default) if you do create a Conda env in your own project folder and activate it the name prefix that appears in your shell is the (way too long) absolute path to the folder. You can fix that by giving it a name, but virtualenv does the right thing by default.

I expect this info to become stale rapidly as the two package managers vie for dominance, but these are the trade-offs as of today :)


回答 5

Pipenv是另一个新的选择,也是我当前首选的启动和运行环境的方法。

目前,它是Python.org官方推荐的Python打包工具

Another new option and my current preferred method of getting an environment up and running is Pipenv

It is currently the officially recommended Python packaging tool from Python.org


回答 6

是的,conda它比容易安装得多virtualenv,并且几乎可以替代后者。

Yes, conda is a lot easier to install than virtualenv, and pretty much replaces the latter.


回答 7

我在公司工作,在几台没有管理员权限的计算机的防火墙后面

以我有限的python使用经验(两年),我遇到了几个库(JayDeBeApi,sasl),这些库通过pip安装时会抛出C ++依赖项错误错误:需要Microsoft Visual C ++ 14.0。使用“ Microsoft Visual C ++生成工具”获得它:http : //landinghub.visualstudio.com/visual-cpp-build-tools

这些用conda安装得很好,因此从那以后,我开始使用conda env。但是要阻止conda从c.programfiles里面安装依赖项并不容易,因为我没有写权限。

I work in corporate, behind several firewall with machine on which I have no admin acces

In my limited experience with python (2 years) i have come across few libraries (JayDeBeApi,sasl) which when installing via pip threw C++ dependency errors error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools

these installed fine with conda, hence since those days i started working with conda env. however it isnt easy to stop conda from installing dependency inside c.programfiles where i dont have write access.


水蟒vs.迷你康达

问题:水蟒vs.迷你康达

Anaconda存储库中,有两种安装程序:

Anaconda安装程序 ”和“ Miniconda安装程序 ”。

他们有什么区别?

此外,对于安装程序文件,Anaconda2-4.4.0.1-Linux-ppc64le.sh,这是什么2-4.4.0.1立场?

In the Anaconda repository, there are two types of installers:

Anaconda installers” and “Miniconda installers“.

What are their differences?

Besides, for an installer file, Anaconda2-4.4.0.1-Linux-ppc64le.sh, what does 2-4.4.0.1 stand for?


回答 0

区别在于miniconda只是在交付存储库管理系统。因此,当您安装它时,只有管理系统没有软件包。而对于Anaconda,它就像带有某些内置软件包的发行版。

与任何Linux发行版一样,有些发行版捆绑了所包含软件包的许多更新。这就是为什么版本编号有所不同的原因。如果您仅决定升级Anaconda,那么您将更新整个系统。

The difference is that miniconda is just shipping the repository management system. So when you install it there is just the management system without packages. Whereas with Anaconda, it is like a distribution with some built in packages.

Like with any Linux distribution, there are some releases which bundles lots of updates for the included packages. That is why there is a difference in version numbering. If you only decide to upgrade Anaconda, you are updating a whole system.


回答 1

根据原始文档(链接现在不可用):

如果您选择Anaconda,则:

  • 是conda或Python的新手
  • 就像一次安装Python和150多个科学软件包的便利一样
  • 有时间和磁盘空间(几分钟和3 GB),和/或
  • 不想安装要单独使用的每个软件包。

如果您选择Miniconda,则:

  • 不要介意安装要单独使用的每个软件包。
  • 没有时间或磁盘空间来一次安装150个以上的软件包,和/或
  • 只想快速访问Python和conda命令,并希望以后整理其他程序。

我自己使用Miniconda。Pythonis肿。许多软件包从未使用过,并且在需要时仍可以轻松安装。

请注意,Conda是软件包管理器(例如,conda list显示环境中所有已安装的软件包),而Anaconda和Miniconda是发行版。软件分发是可以在系统上安装和使用的,预先构建和预先配置的软件包的集合。程序包管理器是一种工具,可自动执行安装,更新和删除程序包的过程。

Anaconda是PyData生态系统中中央软件的完整发行版,并且包含Python本身以及用于数百个第三方开源项目的二进制文件。Miniconda本质上是一个空conda环境的安装程序,仅包含Conda,其依赖项和Python。 来源

一旦安装了Conda,您就可以从头开始安装所需的任何软件包以及任何所需的Python版本。

2-4.4.0.1是Anaconda安装包的版本号。奇怪的是,它没有列在其“ 旧软件包列表”中

在2016年4月,Anaconda版本从2.5跃升至4.0,以避免与Python版本2和3混淆。版本4.0包含Anaconda Navigator。

可以在此处找到后续版本的发行说明。

Per the original docs (link is now dead):

Choose Anaconda if you:

  • Are new to conda or Python
  • Like the convenience of having Python and over 150 scientific packages automatically installed at once
  • Have the time and disk space (a few minutes and 3 GB), and/or
  • Don’t want to install each of the packages you want to use individually.

Choose Miniconda if you:

  • Do not mind installing each of the packages you want to use individually.
  • Do not have time or disk space to install over 150 packages at once, and/or
  • Just want fast access to Python and the conda commands, and wish to sort out the other programs later.

I use Miniconda myself. Anaconda is bloated. Many of the packages are never used and could still be easily installed if and when needed.

Note that Conda is the package manager (e.g. conda list displays all installed packages in the environment), whereas Anaconda and Miniconda are distributions. A software distribution is a collection of packages, pre-built and pre-configured, that can be installed and used on a system. A package manager is a tool that automates the process of installing, updating, and removing packages.

Anaconda is a full distribution of the central software in the PyData ecosystem, and includes Python itself along with the binaries for several hundred third-party open-source projects. Miniconda is essentially an installer for an empty conda environment, containing only Conda, its dependencies, and Python. Source.

Once Conda is installed, you can then install whatever package you need from scratch along with any desired version of Python.

2-4.4.0.1 is the version number for your Anaconda installation package. Strangely, it is not listed in their Old Package Lists.

In April 2016, the Anaconda versioning jumped from 2.5 to 4.0 in order to avoid confusion with Python versions 2 & 3. Version 4.0 included the Anaconda Navigator.

Release notes for subsequent versions can be found here.


回答 2

简要

conda 既是命令行工具,又是python包。

Miniconda安装程序= Python + conda

Anaconda安装程序= Python conda++ meta包 anaconda

meta Python pkg anaconda=数据科学中日常使用的约160 Python pkg

Anaconda安装程序= Miniconda安装程序+ conda install anaconda

详情

  1. conda 是python管理器和环境管理器,这使得

    • 安装软件包 conda install flake8
    • 使用任何版本的Python创建环境 conda create -n myenv python=3.6
  2. Miniconda安装程序= Python + conda

    conda,软件包管理器和环境管理器,是一个Python软件包。这样就安装了Python。原因畅达分发Python解释器与它自己的库/依存关系,但不是你的操作系统上现有的其他最小的相关喜欢opensslncursessqlite,等还安装了。

    基本上,Miniconda是公正的,conda并且它具有最小的依赖关系conda安装的环境是“基础”环境,以前称为“根”环境。

  3. Anaconda安装程序= Python conda++ meta包anaconda

  4. meta Python程序包anaconda=约160 pkg pkg,用于数据科学中的日常使用

    元软件包是不包含实际软件的软件包,仅依赖于要安装的其他软件包。

    anacondaAnaconda Cloud下载一个meta包并从中提取内容。实际列出了要安装的160多个软件包info/recipe/meta.yaml

    package:
        name: anaconda
        version: '2019.07'
    build:
        ignore_run_exports:
            - '*'
        number: '0'
        pin_depends: strict
        string: py36_0
    requirements:
        build:
            - python 3.6.8 haf84260_0
        is_meta_pkg:
            - true
        run:
            - alabaster 0.7.12 py36_0
            - anaconda-client 1.7.2 py36_0
            - anaconda-project 0.8.3 py_0
            # ...
            - beautifulsoup4 4.7.1 py36_1
            # ...
            - curl 7.65.2 ha441bb4_0
            # ...
            - hdf5 1.10.4 hfa1e0ec_0
            # ...
            - ipykernel 5.1.1 py36h39e3cac_0
            - ipython 7.6.1 py36h39e3cac_0
            - ipython_genutils 0.2.0 py36h241746c_0
            - ipywidgets 7.5.0 py_0
            # ...
            - jupyter 1.0.0 py36_7
            - jupyter_client 5.3.1 py_0
            - jupyter_console 6.0.0 py36_0
            - jupyter_core 4.5.0 py_0
            - jupyterlab 1.0.2 py36hf63ae98_0
            - jupyterlab_server 1.0.0 py_0
            # ...
            - matplotlib 3.1.0 py36h54f8f79_0
            # ...
            - mkl 2019.4 233
            - mkl-service 2.0.2 py36h1de35cc_0
            - mkl_fft 1.0.12 py36h5e564d8_0
            - mkl_random 1.0.2 py36h27c97d8_0
            # ...
            - nltk 3.4.4 py36_0
            # ...
            - numpy 1.16.4 py36hacdab7b_0
            - numpy-base 1.16.4 py36h6575580_0
            - numpydoc 0.9.1 py_0
            # ...
            - pandas 0.24.2 py36h0a44026_0
            - pandoc 2.2.3.2 0
            # ...
            - pillow 6.1.0 py36hb68e598_0
            # ...
            - pyqt 5.9.2 py36h655552a_2
            # ...
            - qt 5.9.7 h468cd18_1
            - qtawesome 0.5.7 py36_1
            - qtconsole 4.5.1 py_0
            - qtpy 1.8.0 py_0
            # ...
            - requests 2.22.0 py36_0
            # ...
            - sphinx 2.1.2 py_0
            - sphinxcontrib 1.0 py36_1
            - sphinxcontrib-applehelp 1.0.1 py_0
            - sphinxcontrib-devhelp 1.0.1 py_0
            - sphinxcontrib-htmlhelp 1.0.2 py_0
            - sphinxcontrib-jsmath 1.0.1 py_0
            - sphinxcontrib-qthelp 1.0.2 py_0
            - sphinxcontrib-serializinghtml 1.1.3 py_0
            - sphinxcontrib-websupport 1.1.2 py_0
            - spyder 3.3.6 py36_0
            - spyder-kernels 0.5.1 py36_0
            # ...
    

    来自meta pkg的预安装软件包anaconda主要用于Web抓取和数据科学。像requestsbeautifulsoupnumpynltk,等。

    如果您安装了Miniconda,conda install anaconda则将使其与Anaconda安装相同,但安装文件夹名称不同。

  5. Miniconda2和Miniconda。Anaconda2和Anaconda。

    2表示conda在“基本”环境中捆绑的Python解释器是Python 2,而不是Python 3。

Brief

conda is both a command line tool, and a python package.

Miniconda installer = Python + conda

Anaconda installer = Python + conda + meta package anaconda

meta Python pkg anaconda = about 160 Python pkgs for daily use in data science

Anaconda installer = Miniconda installer + conda install anaconda

Detail

  1. conda is a python manager and an environment manager, which makes it possible to

    • install package with conda install flake8
    • create an environment with any version of Python with conda create -n myenv python=3.6
  2. Miniconda installer = Python + conda

    conda, the package manager and environment manager, is a Python package. So Python is installed. Cause conda distribute Python interpreter with its own libraries/dependencies but not the existing ones on your operating system, other minimal dependencies like openssl, ncurses, sqlite, etc are installed as well.

    Basically, Miniconda is just conda and its minimal dependencies. And the environment where conda is installed is the “base” environment, which is previously called “root” environment.

  3. Anaconda installer = Python + conda + meta package anaconda

  4. meta Python package anaconda = about 160 Python pkgs for daily use in data science

    Meta packages, are packages that do NOT contain actual softwares and simply depend on other packages to be installed.

    Download an anaconda meta package from Anaconda Cloud and extract the content from it. The actual 160+ packages to be installed are listed in info/recipe/meta.yaml.

    package:
        name: anaconda
        version: '2019.07'
    build:
        ignore_run_exports:
            - '*'
        number: '0'
        pin_depends: strict
        string: py36_0
    requirements:
        build:
            - python 3.6.8 haf84260_0
        is_meta_pkg:
            - true
        run:
            - alabaster 0.7.12 py36_0
            - anaconda-client 1.7.2 py36_0
            - anaconda-project 0.8.3 py_0
            # ...
            - beautifulsoup4 4.7.1 py36_1
            # ...
            - curl 7.65.2 ha441bb4_0
            # ...
            - hdf5 1.10.4 hfa1e0ec_0
            # ...
            - ipykernel 5.1.1 py36h39e3cac_0
            - ipython 7.6.1 py36h39e3cac_0
            - ipython_genutils 0.2.0 py36h241746c_0
            - ipywidgets 7.5.0 py_0
            # ...
            - jupyter 1.0.0 py36_7
            - jupyter_client 5.3.1 py_0
            - jupyter_console 6.0.0 py36_0
            - jupyter_core 4.5.0 py_0
            - jupyterlab 1.0.2 py36hf63ae98_0
            - jupyterlab_server 1.0.0 py_0
            # ...
            - matplotlib 3.1.0 py36h54f8f79_0
            # ...
            - mkl 2019.4 233
            - mkl-service 2.0.2 py36h1de35cc_0
            - mkl_fft 1.0.12 py36h5e564d8_0
            - mkl_random 1.0.2 py36h27c97d8_0
            # ...
            - nltk 3.4.4 py36_0
            # ...
            - numpy 1.16.4 py36hacdab7b_0
            - numpy-base 1.16.4 py36h6575580_0
            - numpydoc 0.9.1 py_0
            # ...
            - pandas 0.24.2 py36h0a44026_0
            - pandoc 2.2.3.2 0
            # ...
            - pillow 6.1.0 py36hb68e598_0
            # ...
            - pyqt 5.9.2 py36h655552a_2
            # ...
            - qt 5.9.7 h468cd18_1
            - qtawesome 0.5.7 py36_1
            - qtconsole 4.5.1 py_0
            - qtpy 1.8.0 py_0
            # ...
            - requests 2.22.0 py36_0
            # ...
            - sphinx 2.1.2 py_0
            - sphinxcontrib 1.0 py36_1
            - sphinxcontrib-applehelp 1.0.1 py_0
            - sphinxcontrib-devhelp 1.0.1 py_0
            - sphinxcontrib-htmlhelp 1.0.2 py_0
            - sphinxcontrib-jsmath 1.0.1 py_0
            - sphinxcontrib-qthelp 1.0.2 py_0
            - sphinxcontrib-serializinghtml 1.1.3 py_0
            - sphinxcontrib-websupport 1.1.2 py_0
            - spyder 3.3.6 py36_0
            - spyder-kernels 0.5.1 py36_0
            # ...
    

    The pre-installed packages from meta pkg anaconda are mainly for web scraping and data science. Like requests, beautifulsoup, numpy, nltk, etc.

    If you have a Miniconda installed, conda install anaconda will make it same as an Anaconda installation, except that the installation folder names are different.

  5. Miniconda2 v.s. Miniconda. Anaconda2 v.s. Anaconda.

    2 means the bundled Python interpreter for conda in the “base” environment is Python 2, but not Python 3.


回答 3

Miniconda可以为您提供Python解释器本身,以及一个名为conda的命令行工具,该工具可以作为跨平台的软件包管理器运行,专门针对Python软件包,其实质类似于Linux用户可能熟悉的apt或yum工具。

Anaconda既包含Python又包含conda,并捆绑了一系列其他针对科学计算的预安装软件包。由于此捆绑包的大小,预计安装会占用几GB的磁盘空间。

资料来源:Jake VanderPlas的《Python数据科学手册》

Miniconda gives you the Python interpreter itself, along with a command-line tool called conda which operates as a cross-platform package manager geared toward Python packages, similar in spirit to the apt or yum tools that Linux users might be familiar with.

Anaconda includes both Python and conda, and additionally bundles a suite of other pre-installed packages geared toward scientific computing. Because of the size of this bundle, expect the installation to consume several gigabytes of disk space.

Source: Jake VanderPlas’s Python Data Science Handbook


回答 4

2Anaconda2,这意味着Python的主要版本将2.x的,而不是安装在3.x Anaconda3。当前版本具有Python 2.7.13。

4.4.0.1是Anaconda的版本号。当前发布的版本是4.4.0,我假设该版本是.1次要版本或用于其他类似用途。我使用的Windows版本仅4.4.0在文件名中说。

现在其他人已经解释了Anaconda和Miniconda之间的区别,因此我将跳过。

The 2 in Anaconda2 means that the main version of Python will be 2.x rather than the 3.x installed in Anaconda3. The current release has Python 2.7.13.

The 4.4.0.1 is the version number of Anaconda. The current advertised version is 4.4.0 and I assume the .1 is a minor release or for other similar use. The Windows releases, which I use, just say 4.4.0 in the file name.

Others have now explained the difference between Anaconda and Miniconda, so I’ll skip that.


回答 5

Anaconda是一个非常大的安装〜2 GB,对于那些不熟悉与其他软件包管理器一起安装模块或软件包的用户而言,最为有用。

Anaconda似乎正在提升自己作为Jupyter的官方包装经理。不是。Anaconda将Jupyter,R,python和许多软件包捆绑在一起安装。

Anaconda不需要安装Jupyter Lab或R内核。有关在其他地方安装Jupyter Lab或Notebook的大量信息。其他地方,还有许多有关安装R Studio的信息。下面显示了如何直接从R Studio安装R内核:

要在没有Anaconda的情况下安装R内核,请启动R Studio。在R终端窗口中,输入以下三个命令:

install.packages("devtools")
devtools::install_github("IRkernel/IRkernel")
IRkernel::installspec()

做完了 下次打开Jupyter时,R内核将可用。

Anaconda is a very large installation ~ 2 GB and is most useful for those users who are not familiar with installing modules or packages with other package managers.

Anaconda seems to be promoting itself as the official package manager of Jupyter. It’s not. Anaconda bundles Jupyter, R, python, and many packages with its installation.

Anaconda is not necessary for installing Jupyter Lab or the R kernel. There is plenty of information available elsewhere for installing Jupyter Lab or Notebooks. There is also plenty of information elsewhere for installing R studio. The following shows how to install the R kernel directly from R Studio:

To install the R kernel, without Anaconda, start R Studio. In the R terminal window enter these three commands:

install.packages("devtools")
devtools::install_github("IRkernel/IRkernel")
IRkernel::installspec()

Done. The next time Jupyter is opened, the R kernel will be available and available.


回答 6

无论Python和miniconda使用畅达包管理器。Anacondaminiconda之间的主要区别在于

Anaconda发行版预装了所有软件包,而miniconda发行版只是管理系统,没有任何预装软件包。如果使用miniconda,则必须分别下载单个软件包和库。

我个人使用Anaconda发行版,因为我真的不必担心单个软件包的安装。

miniconda的一个缺点是,安装每个单个包可利用长量时间。与安装和使用Anaconda相比,花费的时间要少得多。

但是,anaconda中有一些我从未使用过的软件包(QtConsole,Glueviz,Orange3)。我什至不知道他们的目的。因此,Python的一个缺点是它占用了比所需更多的空间。

Both Anaconda and miniconda use the conda package manager. The chief differece between between Anaconda and miniconda,however,is that

The Anaconda distribution comes pre-loaded with all the packages while the miniconda distribution is just the management system without any pre-loaded packages. If one uses miniconda, one has to download individual packages and libraries separately.

I personally use Anaconda distribution as I dont really have to worry much about individual package installations.

A disadvantage of miniconda is that installing each individual package can take a long amount of time. Compared to that installing and using Anaconda takes a lot less time.

However, there are some packages in anaconda (QtConsole, Glueviz,Orange3) that I have never had to use. I dont even know their purpose. So a disadvantage of anaconda is that it occupies more space than needed.


Python Anaconda-如何安全卸载

问题:Python Anaconda-如何安全卸载

我在Mac(OS Mavericks)上安装了Python Anaconda。我想在Mac上恢复为默认版本的Python。最好的方法是什么?我应该删除~/anaconda目录吗?还需要其他更改吗?

当前,当我运行时,which python我会得到以下路径:

/Users/username/anaconda/bin/python

I installed Python Anaconda on Mac (OS Mavericks). I wanted to revert to the default version of Python on my Mac. What’s the best way to do this? Should I delete the ~/anaconda directory? Any other changes required?

Currently when I run which python I get this path:

/Users/username/anaconda/bin/python


回答 0

文档

要卸载Anaconda,请打开终端窗口并删除整个anaconda安装目录:rm -rf ~/anaconda。您也可以编辑 ~/.bash_profile和删除的森蚺目录PATH 的环境变量,并删除隐藏.condarc文件, .conda.continuum可能已在主目录中创建的目录rm -rf ~/.condarc ~/.conda ~/.continuum

进一步说明:

  • Python3安装可能使用~/anaconda3dir而不是~/anaconda
  • 您可能还有一个~/.anaconda隐藏目录,可以将其删除。
  • 根据您的安装方式,可能会在PATH您的runco​​m文件之一而不是您的Shell配置文件中对其进行修改。因此,例如,如果您使用的是bash,请确保检查您~/.bashrc是否在中没有找到PATH修改过的内容~/.bash_profile

From the docs:

To uninstall Anaconda open a terminal window and remove the entire anaconda install directory: rm -rf ~/anaconda. You may also edit ~/.bash_profile and remove the anaconda directory from your PATH environment variable, and remove the hidden .condarc file and .conda and .continuum directories which may have been created in the home directory with rm -rf ~/.condarc ~/.conda ~/.continuum.

Further notes:

  • Python3 installs may use a ~/anaconda3 dir instead of ~/anaconda.
  • You might also have a ~/.anaconda hidden directory that may be removed.
  • Depending on how you installed, it is possible that the PATH is modified in one of your runcom files, and not in your shell profile. So, for example if you are using bash, be sure to check your ~/.bashrc if you don’t find the PATH modified in ~/.bash_profile.

回答 1

anaconda安装程序会在~/.bash_profile脚本中添加一行,以将anaconda bin目录添加到您的$PATH环境变量中。删除anaconda目录应该是您需要做的所有事情,但是也可以从安装脚本中删除此行,这是很好的整理工作。

The anaconda installer adds a line in your ~/.bash_profile script that prepends the anaconda bin directory to your $PATH environment variable. Deleting the anaconda directory should be all you need to do, but it’s good housekeeping to remove this line from your setup script too.


回答 2

可从Anaconda平台获得的“ anaconda clean软件包应安全卸载。

conda install anaconda-clean   # install the package anaconda clean
anaconda-clean --yes           # clean all anaconda related files and directories 
rm -rf ~/anaconda3             # removes the entire anaconda directory

rm -rf ~/.anaconda_backup       # anaconda clean creates a back_up of files/dirs, remove it 
                                # (conda list; cmd shouldn't respond after the clean up)

请参阅:https//docs.anaconda.com/anaconda/install/uninstall以获得更多详细信息。

Packageanaconda clean“, available from Anaconda platform, should uninstall safely.

conda install anaconda-clean   # install the package anaconda clean
anaconda-clean --yes           # clean all anaconda related files and directories 
rm -rf ~/anaconda3             # removes the entire anaconda directory

rm -rf ~/.anaconda_backup       # anaconda clean creates a back_up of files/dirs, remove it 
                                # (conda list; cmd shouldn't respond after the clean up)

Refer: https://docs.anaconda.com/anaconda/install/uninstall for more details.


回答 3

删除Anaconda目录会有所帮助,但是我认为这不是一个好主意,因为您可能需要在不久的将来使用anaconda。因此,按照mwaskom的建议,anaconda安装程序会自动添加PATH指向文件中anaconda/bin目录的变量~/.bashrc

看起来像这样

PATH="/home/linuxsagar/anaconda3/bin:$PATH

因此,只需注释掉这一行(在行#的开头添加)。然后重新加载~/.bashrc文件执行source ~/.bashrc

现在,验证which python在新终端中执行的更改。

Removing the Anaconda directory helps, but I don’t think that’s a good idea as you might need to use anaconda sometimes in near future. So, as suggested by mwaskom, anaconda installer automatically adds PATH variable which points to anaconda/bin directory in the ~/.bashrc file.

It looks like this

PATH="/home/linuxsagar/anaconda3/bin:$PATH

So, just comment out the line (add # in the beginning of the line). Then reload the ~/.bashrc file executing source ~/.bashrc

Now, verify the changes executing which python in the new terminal.


回答 4

rm -rf ~/anaconda

这很容易。它将我的指针切换到了Python:https : //docs.continuum.io/anaconda/install#os-x-uninstall

rm -rf ~/anaconda

It was pretty easy. It switched my pointer to Python: https://docs.continuum.io/anaconda/install#os-x-uninstall


回答 5

如果要卸载Anaconda以便能够在系统中使用基本的Python安装,则可以按照以下步骤暂时禁用路径,而不要卸载Anaconda。

转到您的主目录。只需一条cd命令即可。

编辑文件.bashrc

查找类似export PATH="/home/ubuntu/anaconda3/bin:$PATH"文件中的内容。

将a #放在开头,以从脚本中对其进行注释。

#export PATH="/home/ubuntu/anaconda3/bin:$PATH"

打开一个新的终端,您应该正在运行基本的python安装。这适用于Linux系统。应该也可以在Mac上使用。

If you’re uninstalling Anaconda to be able to use the base Python installation in the system, you could temporarily disable the path by following these steps and not uninstalling Anaconda.

Go to your home directory. Just a cd command will do.

Edit the file .bashrc.

Look for something like export PATH="/home/ubuntu/anaconda3/bin:$PATH" in the file.

Put a # at the beginning to comment it from the script.

#export PATH="/home/ubuntu/anaconda3/bin:$PATH"

Open a new terminal and you should be running the base python installation. This works on Linux systems. Should work on Mac too.


回答 6

卸载Anaconda

要卸载Anaconda,您可以简单地删除该程序。这将留下一些文件,对于大多数用户来说就足够了。请参阅选项A。

如果您还想从Anaconda及其程序中删除配置文件和目录的所有痕迹,则可以先下载并使用Anaconda-Clean程序,然后进行简单的删除。请参阅选项B。

选项A。

使用简单删除来卸载Anaconda:

macOS –打开Terminal.app或iTerm2终端应用程序,然后通过输入删除整个Anaconda目录,该目录的名称为anaconda2或anaconda3 rm -rf ~/anaconda3

选项B。

使用Anaconda-Clean完全卸载并简单删除。

注意:必须先运行Anaconda-Clean,然后才能将其卸下。

从Anaconda Prompt或终端窗口安装Anaconda-Clean软件包:

conda install anaconda-clean

在同一窗口中,运行以下命令之一:

在删除每个与Anaconda相关的文件和目录之前,先确认确认,然后删除每个文件和目录:

anaconda-clean

或者,删除所有与Anaconda相关的文件和目录,而不会提示您删除每个文件和目录:

anaconda-clean --yes

Anaconda-Clean 在您的主目录中.bash_profile命名的文件夹.anaconda_backup中创建所有可能删除的文件和目录的备份,例如,。还要注意,Anaconda-Clean不会改变您在AnacondaProjects目录中的数据文件。使用Anaconda-Clean之后,请按照上述选项A中的说明卸载Anaconda。从中删除Anaconda路径.bash_profile

如果您使用Linux或macOS,则还可能希望检查.bash_profile您的主目录中的文件是否存在以下行:

export PATH="/Users/jsmith/anaconda3/bin:$PATH"

注意:替换/Users/jsmith/anaconda3/为您的实际路径。

此行将Anaconda路径添加到PATH环境变量中。它可能指的是Anaconda或Miniconda。卸载Anaconda后,您可以删除此行并保存文件。

通过官方卸载方式

Uninstalling Anaconda

To uninstall Anaconda, you can do a simple remove of the program. This will leave a few files behind, which for most users is just fine. See Option A.

If you also want to remove all traces of the configuration files and directories from Anaconda and its programs, you can download and use the Anaconda-Clean program first, then do a simple remove. See Option B.

Option A.

Use simple remove to uninstall Anaconda:

macOS–Open the Terminal.app or iTerm2 terminal application, and then remove your entire Anaconda directory, which has a name such as anaconda2 or anaconda3, by entering rm -rf ~/anaconda3.

Option B.

Full uninstall using Anaconda-Clean and simple remove.

NOTE: Anaconda-Clean must be run before simple remove.

Install the Anaconda-Clean package from Anaconda Prompt or a terminal window:

conda install anaconda-clean

In the same window, run one of these commands:

Remove all Anaconda-related files and directories with a confirmation prompt before deleting each one:

anaconda-clean

Or, remove all Anaconda-related files and directories without being prompted to delete each one:

anaconda-clean --yes

Anaconda-Clean creates a backup of all files and directories that might be removed, such as .bash_profile, in a folder named .anaconda_backup in your home directory. Also note that Anaconda-Clean leaves your data files in the AnacondaProjects directory untouched. After using Anaconda-Clean, follow the instructions above in Option A to uninstall Anaconda. Removing Anaconda path from .bash_profile

If you use Linux or macOS, you may also wish to check the .bash_profilefile in your home directory for a line such as:

export PATH="/Users/jsmith/anaconda3/bin:$PATH"

NOTE: Replace /Users/jsmith/anaconda3/ with your actual path.

This line adds the Anaconda path to the PATH environment variable. It may refer to either Anaconda or Miniconda. After uninstalling Anaconda, you may delete this line and save the file.

by official uninstalling way


回答 7

rm -rf ~/anaconda3

nano ~/.bashrc
  • Ctrl+ W搜索“ Anaconda”
  • 删除或注释掉以下几行:

    /home/sammuel/.bashrc
    # added by Anaconda3 4.2.0 installer
    export PATH="/home/sammuel/anaconda3/bin:$PATH"

编辑完文件后,输入Ctrl+ X退出并y保存更改。

Anaconda现在已从服务器中删除。

rm -rf ~/anaconda3

nano ~/.bashrc
  • Ctrl+W to search for “Anaconda”
  • Delete or comment out the following lines:

    /home/sammuel/.bashrc
    # added by Anaconda3 4.2.0 installer
    export PATH="/home/sammuel/anaconda3/bin:$PATH"
    

When you’re done editing the file, type Ctrl+X to exit and y to save changes.

Anaconda is now removed from your server.


回答 8

如果您有多个版本的anaconda,

rm -rf〜/ anaconda2 [对于版本2]

rm -rf〜/ anaconda3 [对于版本3]

在文本编辑器中打开.bashrc文件

vim .bashrc

从您的PATH中删除anaconda目录。

导出PATH =“ / home / {username} / anaconda2 / bin:$ PATH” [对于版本2]

导出PATH =“ / home / {username} / anaconda3 / bin:$ PATH” [对于版本3]

In case you have multiple version of anaconda,

rm -rf ~/anaconda2 [for version 2]

rm -rf ~/anaconda3 [for version 3]

Open .bashrc file in a text editor

vim .bashrc

remove anaconda directory from your PATH.

export PATH=”/home/{username}/anaconda2/bin:$PATH” [for version 2]

export PATH=”/home/{username}/anaconda3/bin:$PATH” [for version 3]


回答 9

我只是:

rm -rf ~/anaconda3

…这也删除了conda。

然后:

mousepad ~/.bashrc

…并删除了最底部添加的路径线(Anaconda明确标识为“ Anaconda添加”)。

值得注意的是,anaconda3 在修改之前为我的.bashrc文件创建了一个备份,并将其命名为:

./bashrc-anaconda3.bak

…所以我总是可以将其重命名并删除修改后的.bashrc

I simply:

rm -rf ~/anaconda3

…this removed conda also.

Then:

mousepad ~/.bashrc

…and removed the path line added at the very bottom (clearly identified by Anaconda as ‘added by Anaconda’.

Worth noting that anaconda3 created a backup of my .bashrc file before modification, and named it as:

./bashrc-anaconda3.bak

…so I could always have just renamed this and deleted my modified .bashrc


回答 10

要卸载anaconda,您必须:

1)使用以下命令删除整个anaconda安装目录:

rm -rf ~/anaconda2

2)和(可选):

->编辑〜/ .bash_profile以从PATH环境变量中删除anaconda目录。

->删除以下可能在主目录中创建的隐藏文件和文件夹:

rm -rf ~/.condarc ~/.conda ~/.continuum

资源

To uninstall anaconda you have to:

1) Remove the entire anaconda install directory with:

rm -rf ~/anaconda2

2) And (OPTIONAL):

->Edit ~/.bash_profile to remove the anaconda directory from your PATH environment variable.

->Remove the following hidden file and folders that may have been created in the home directory:

rm -rf ~/.condarc ~/.conda ~/.continuum

source


回答 11

要从系统中完全卸载Anaconda,请执行以下操作:

  1. 开放终端
  2. rm -rf ~/miniconda
  3. rm -rf ~/.condarc ~/.conda ~/.continuum

To uninstall Anaconda Fully from your System :

  1. Open Terminal
  2. rm -rf ~/miniconda
  3. rm -rf ~/.condarc ~/.conda ~/.continuum

回答 12

rm -rf ~/anaconda3

够了

rm -rf ~/anaconda3

It was enough


回答 13

我一直尝试遵循开发人员的建议,因为现在通常是他们会如何影响您的系统。从理论上讲,这应该是最安全的方法:


从Anaconda Prompt(Linux或macOS上的终端)安装Anaconda-Clean软件包:

conda install anaconda-clean

在同一窗口中,运行以下命令之一:

在删除每个与Anaconda相关的文件和目录之前,先确认确认,然后删除每个文件和目录:

anaconda-clean

或者,删除所有与Anaconda相关的文件和目录,而不会提示您删除每个文件和目录:

anaconda-clean --yes

Anaconda-Clean创建所有可能在主目录中名为.anaconda_backup的文件夹中删除的文件和目录的备份。还要注意,Anaconda-Clean不会改变您在AnacondaProjects目录中的数据文件。

https://docs.anaconda.com/anaconda/install/uninstall/

I always try to follow the developers advice, since they are usually the ones that now how it would affect your system. Theoretically this should be the safest way:

Install the Anaconda-Clean package from Anaconda Prompt (terminal on Linux or macOS):

conda install anaconda-clean

In the same window, run one of these commands:

  1. Remove all Anaconda-related files and directories with a confirmation prompt before deleting each one:

anaconda-clean

  1. Remove all Anaconda-related files and directories without being prompted to delete each one:

anaconda-clean --yes

Anaconda-Clean creates a backup of all files and directories that might be removed in a folder named .anaconda_backup in your home directory. Also note that Anaconda-Clean leaves your data files in the AnacondaProjects directory untouched.

https://docs.anaconda.com/anaconda/install/uninstall/


回答 14

就我而言,Anaconda3尚未安装在主目录中。而是将其安装在root用户中。因此,我必须执行以下操作才能将其卸载:

sudo rm -rf /anaconda3/bin/python

In my case Anaconda3 was not installed in home directory. Instead, it was installed in root. Therefore, I had to do the following to get it uninstalled:

sudo rm -rf /anaconda3/bin/python

回答 15

对于窗户

  • 使用以下命令安装anaconda-clean模块

    conda install anaconda-clean

    然后,运行以下命令逐步删除文件:

    anaconda-clean

    或者,只需运行以下命令将其全部删除-

    anaconda-clean --yes
  • 在此打开控制面板>程序>卸载程序之后,在这里卸载发布者是Anaconda的python。

  • 现在,您可以从PATH变量中删除anaconda / scripts和/ anaconda /。

希望能帮助到你。

For windows

  • Install anaconda-clean module using

    conda install anaconda-clean
    

    then, run the following command to delete files step by step:

    anaconda-clean
    

    Or, just run following command to delete them all-

    anaconda-clean --yes
    
  • After this Open Control Panel> Programs> Uninstall Program, here uninstall that python for which publisher is Anaconda.

  • Now, you can remove anaconda/scripts and /anaconda/ from PATH variable.

Hope, it helps.


如何更新Anaconda?

问题:如何更新Anaconda?

我的计算机上安装了Anaconda,我想对其进行更新。在Navigator中,我可以看到有几个单独的软件包可以更新,但anaconda有时也有版本号,有时显示custom。我该如何进行?

I have Anaconda installed on my computer and I’d like to update it. In Navigator I can see that there are several individual packages that can be updated, but also an anaconda package that sometimes has a version number and sometimes says custom. How do I proceed?


回答 0

95%的人实际想要什么

在大多数情况下,当您说要更新Anaconda时,要执行的命令是执行以下命令:

conda update --all

(但是,这应该preceeded通过conda update -n root conda让你拥有最新conda安装的版本)

这会将当前环境中的所有软件包更新为最新版本-较小的字样是它可能会使用某些版本的旧软件包以满足相关性约束(通常不需要这样做,并且在必要时可以打包方案求解器将尽最大努力将影响降到最低)。

这需要从命令行执行,并且到达那里的最佳方法是从Anaconda Navigator,然后单击“环境”选项卡,然后单击root环境旁边的三角形,选择“打开终端”:

此操作将仅更新一个选定的环境(在这种情况下为root环境)。如果您要更新其他环境,则可以重复上述过程,但请先单击该环境。选择该选项后,右侧会有一个三角形标记(请参见上图,第3步)。或从命令行中,您可以提供环境名称(-n envname)或路径(-p /path/to/env),例如,dspyr从上面的屏幕截图中更新您的环境:

conda update -n dspyr --all

更新单个软件包

如果您只对更新单个软件包感兴趣,则只需在Navigator中单击蓝色箭头或蓝色版本号,例如在上面的屏幕截图中astroidastropy在上面的屏幕截图中,这将标记这些软件包以进行升级。完成后,您需要单击“应用”按钮:

或从命令行:

conda update astroid astropy

仅更新标准Anaconda发行版中的软件包

如果您不关心软件包的版本,而只是想要“标准Anaconda发行版中所有软件包的最新集合,只要它们可以一起使用”,那么您应该了解一下这个要点

为什么更新Anaconda软件包几乎总是一个坏主意

在大多数情况下,更新软件包列表中的Anaconda软件包将产生令人惊讶的结果:您实际上可以降级许多软件包(实际上,如果将版本表示为,则可能会降级custom)。上面的要点提供了详细信息。

利用conda环境

您的root环境可能不是尝试管理一组确切软件包的好地方:它将是一个动态工作空间,其中安装了新软件包并随机更新了软件包。如果您需要一组确切的软件包,请创建一个conda环境来保存它们。多亏了conda软件包缓存和文件链接的使用方式,通常i)快速,并且ii)占用很少的额外磁盘空间。例如

conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk

畅达文档有更多的细节和例子。

pip,PyPI和setuptools?

这些都无法帮助更新通过PyPI从PyPI pip安装的软件包或使用来安装的任何软件包python setup.py installconda list会为您提供有关环境中基于pip的Python软件包的一些提示,但不会对其进行任何特殊更新。

Anaconda或Anaconda Enterprise的商业用途

它几乎是完全相同的故事,除了root如果环境是由其他人安装的(例如/opt/anaconda/latest),您可能无法更新。如果您无法更新正在使用的环境,则应该能够克隆然后更新:

conda create -n myenv --clone root
conda update -n myenv --all

root is the old (pre-conda 4.4) name for the main environment; after conda 4.4, it was renamed to be base. source

What 95% of people actually want

In most cases what you want to do when you say that you want to update Anaconda is to execute the command:

conda update --all

(But this should be preceeded by conda update -n base conda so you have the latest conda version installed)

This will update all packages in the current environment to the latest version — with the small print being that it may use an older version of some packages in order to satisfy dependency constraints (often this won’t be necessary and when it is necessary the package plan solver will do its best to minimize the impact).

This needs to be executed from the command line, and the best way to get there is from Anaconda Navigator, then the “Environments” tab, then click on the triangle beside the base environment, selecting “Open Terminal”:

This operation will only update the one selected environment (in this case, the base environment). If you have other environments you’d like to update you can repeat the process above, but first click on the environment. When it is selected there is a triangular marker on the right (see image above, step 3). Or from the command line you can provide the environment name (-n envname) or path (-p /path/to/env), for example to update your dspyr environment from the screenshot above:

conda update -n dspyr --all

Update individual packages

If you are only interested in updating an individual package then simply click on the blue arrow or blue version number in Navigator, e.g. for astroid or astropy in the screenshot above, and this will tag those packages for an upgrade. When you are done you need to click the “Apply” button:

Or from the command line:

conda update astroid astropy

Updating just the packages in the standard Anaconda Distribution

If you don’t care about package versions and just want “the latest set of all packages in the standard Anaconda Distribution, so long as they work together”, then you should take a look at this gist.

Why updating the Anaconda package is almost always a bad idea

In most cases updating the Anaconda package in the package list will have a surprising result: you may actually downgrade many packages (in fact, this is likely if it indicates the version as custom). The gist above provides details.

Leverage conda environments

Your base environment is probably not a good place to try and manage an exact set of packages: it is going to be a dynamic working space with new packages installed and packages randomly updated. If you need an exact set of packages then create a conda environment to hold them. Thanks to the conda package cache and the way file linking is used doing this is typically i) fast and ii) consumes very little additional disk space. E.g.

conda create -n myspecialenv -c bioconda -c conda-forge python=3.5 pandas beautifulsoup seaborn nltk

The conda documentation has more details and examples.

pip, PyPI, and setuptools?

None of this is going to help with updating packages that have been installed from PyPI via pip or any packages installed using python setup.py install. conda list will give you some hints about the pip-based Python packages you have in an environment, but it won’t do anything special to update them.

Commercial use of Anaconda or Anaconda Enterprise

It is pretty much exactly the same story, with the exception that you may not be able to update the base environment if it was installed by someone else (say to /opt/anaconda/latest). If you’re not able to update the environments you are using you should be able to clone and then update:

conda create -n myenv --clone base
conda update -n myenv --all

回答 1

如果您尝试将Anaconda版本更新为新版本,则会注意到运行新安装程序无效,因为它抱怨安装目录为非空。

因此,您应该使用conda进行升级,如官方文档所述

conda update conda
conda update anaconda


在Windows中,如果进行了“针对所有用户”安装,则可能需要从具有管理员权限的Anaconda提示符下运行。

这样可以防止错误:

错误conda.core.link:_execute(502):卸载软件包“ defaults :: conda-4.5.4-py36_0”时发生错误。PermissionError(13,’访问被拒绝’)

If you are trying to update your Anaconda version to a new one, you’ll notice that running the new installer wouldn’t work, as it complains the installation directory is non-empty.

So you should use conda to upgrade as detailed by the official docs:

conda update conda
conda update anaconda


In Windows, if you made a “for all users” installation, it might be necessary to run from an Anaconda prompt with Administrator privileges.

This prevents the error:

ERROR conda.core.link:_execute(502): An error occurred while uninstalling package ‘defaults::conda-4.5.4-py36_0’. PermissionError(13, ‘Access is denied’)


回答 2

打开“命令或conda提示符”并运行:

conda update conda
conda update anaconda

最好两次运行两个命令(一个接一个),以确保所有基本文件都已更新。

这应该使您重新使用最新的“发行版”,其中包含Continuum的人员选择的软件包以使其协同工作。

如果要运行每个软件包的最新版本(这可能导致不稳定的环境):

conda update --all 

希望这可以帮助。

资料来源:

Open “command or conda prompt” and run:

conda update conda
conda update anaconda

It’s a good idea to run both command twice (one after the other) to be sure that all the basic files are updated.

This should put you back on the latest ‘releases’, which contains packages that are selected by the people at Continuum to work well together.

If you want the last version of each package run (this can lead to an unstable environment):

conda update --all 

Hope this helps.

Sources:


回答 3

如果您无法从例如3.3.x升级到4.x(conda更新conda“无法正常工作”以获取下一个版本),则可以尝试像这样更具体:

conda install conda=4.0 (or conda install anaconda=4.0)

https://www.anaconda.com/blog/developer-blog/anaconda-4-release/

您应该知道自己的操作,因为conda可能会由于强制安装而损坏。如果您想获得更大的灵活性/安全性,可以使用pkg-manager,例如nix(-pkgs)[with nix-shell] / NixOS。

If you have trouble to get e.g. from 3.3.x to 4.x (conda update conda “does not work” to get to the next version) than try it more specific like so:

conda install conda=4.0 (or conda install anaconda=4.0)

https://www.anaconda.com/blog/developer-blog/anaconda-4-release/

You should know what you do, because conda could break due to the forced installation. If you would like to get more flexibility/security you could use pkg-manager like nix(-pkgs) [with nix-shell] / NixOS.


回答 4

这是Anaconda官方文档建议的内容:

conda update conda 
conda update anaconda=2020.02

如果第二行抛出错误(文档中有错字?),则可以在这里工作:

conda install anaconda=2020.02

(您可以在此处找到所有版本说明符)

该命令将更新为Anaconda meta-package的特定版本。

是95%Anaconda用户想要的东西。只需升级到最新版本的Anaconda元软件包(放到一起并由Anaconda发行商进行测试),而不必关心单个软件包的更新状态(由发行conda update --all)。

This is what the official Anaconda documentation recommends:

conda update conda
conda update anaconda=2020.07

If the second line throws an error (typo in the documentation?) this worked here:

conda install anaconda=2020.07

(You can find all version specifier here.)

The command will update to a specific release of the Anaconda meta-package.

This is, IMHO, what 95% of Anaconda users want. Simply upgrading to the latest version of the Anaconda meta-package (put together and tested by the Anaconda Distributors) and not caring about the update status of individual packages (which would be issued by conda update --all).


回答 5

这是最佳做法(以我的拙劣经验来说)。选择这四个软件包还将把所有其他依赖项更新为适当的版本,这将帮助您保持环境的一致性。后者是其他人在较早回应中表达的普遍问题。该解决方案不需要终端。

Here’s the best practice (in my humble experience). Selecting these four packages will also update all other dependencies to the appropriate versions that will help you keep your environment consistent. The latter is a common problem others have expressed in earlier responses. This solution doesn’t need the terminal.


回答 6

在基本模式下打开Anaconda cmd:

然后使用conda update conda更新Anaconda

然后您可以使用conda update –all来更新Anaconda的所有要求

conda update conda  
conda update --all  

Open Anaconda cmd in base mode:

Then use conda update conda to update Anaconda.

You can then use conda update –all to update all the requirements for Anaconda:

conda update conda
conda update --all

回答 7

在Mac上,打开终端并运行以下2条命令。

conda update conda
conda update anaconda

确保多次运行每个命令以更新到当前版本。

On Mac, open a terminal and run the following two commands.

conda update conda
conda update anaconda

Make sure to run each command multiple times to update to the current version.


回答 8

我正在使用Windows10。以下更新所有内容,并安装了一些新软件包,包括python更新(对我来说是3.7.3)。

在外壳上,尝试以下操作(请确保更改Anaconda3 Data的安装位置)。更新所有内容需要一些时间。

conda update --prefix X:\XXXXData\Anaconda3 anaconda

I’m using Windows 10. The following updates everything and also installs some new packages, including a Python update (for me it was 3.7.3).

At the shell, try the following (be sure to change where your Anaconda 3 Data is installed). It takes some time to update everything.

conda update --prefix X:\XXXXData\Anaconda3 anaconda

回答 9

要将安装的版本更新为最新版本(例如2019.07),请运行

conda install anaconda=2019.07

在大多数情况下,此方法可以满足您的需求并避免依赖性问题

To update your installed version to the latest version, say 2019.07, run:

conda install anaconda=2019.07

In most cases, this method can meet your needs and avoid dependency problems.


回答 10

conda create -n py37 -c anaconda anaconda=5.3.1
conda env export -n py37 --file env.yaml

在C:\ Windows \ System32中找到env.yaml并以管理员身份运行cmd

conda env update -n root -f env.yaml  

然后就可以了!

Use:

conda create -n py37 -c anaconda anaconda=5.3.1
conda env export -n py37 --file env.yaml

Locate the env.yaml file in C:\Windows\System32 and run the cmd as administrator:

conda env update -n root -f env.yaml

Then it works!


回答 11

这只能更新python:

conda update python

This can update the Python instance only:

conda update python