简体   繁体   English

如何在conda根环境中恢复到python 2?

[英]How to revert to python 2 in conda root environment?

I created a new python3 environment to install python 3; 我创建了一个新的python3环境来安装python 3; due to the incompatibility between conda and Windows PowerShell , I installed python 3 in both of the root and python3 environment by accident. 由于condaWindows PowerShell不兼容,我偶然在rootpython3环境中都安装了python 3。 Is it possible to revert to python 2 in the root environment? 是否可以在root环境中还原到python 2?

C:\Users\Nick>conda info --env
# conda environments:
#
python3                  C:\application\anaconda\envs\python3
root                  *  C:\application\anaconda


C:\Users\Nick>python -V
Python 3.3.5 :: Continuum Analytics, Inc.

conda install python=2 should do the trick. conda install python=2应该可以解决问题。 Definitely check and make sure that all packages downgraded successfully by inspecting the output of conda list for versions that contain the py3 string. 通过检查py3 conda list的输出是否包含py3字符串,来绝对检查并确保所有软件包都已成功降级。 For any packages that contain py3 in the version string, you should probably just uninstall/reinstall them. 对于任何在版本字符串中包含py3软件包,您可能应该只卸载/重新安装它们。

(Hypothetical) Example: (假设的)示例:

The third column in conda list is the python version. conda list的第三列是python版本。 If you see: 如果你看到:

anaconda-client 1.1.2 py35_0 defaults

then you should 那你应该

conda remove anaconda-client

followed by 其次是

conda install anaconda-client so that it installs the python 2 version. conda install anaconda-client以便安装python 2版本。

Then conda list should show the anaconda-client line like this: 然后, conda list应显示anaconda-client行,如下所示:

anaconda-client 1.1.2 py27_0 defaults . anaconda-client 1.1.2 py27_0 defaults

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM