[英]Anaconda/MacOS: Change default python version
I was using python with anaconda on osx 10.8 when spyder crashed. 当spyder坠毁时,我在osx 10.8上使用了带有anaconda的python。 When I tried to restart it, the launcher showed it as uninstalled.
当我尝试重新启动它时,启动器显示它已卸载。 I figured there might be something wrong with anaconda, so I restarted my computer, but the problem persisted.
我认为anaconda可能有问题,所以我重新启动了我的电脑,但问题仍然存在。
Looking into it, I noticed the default version of python had been changed: 看着它,我注意到python的默认版本已被更改:
$ python --version
Python 3.4.1 :: Continuum Analytics, Inc.
I tried changing it back by using Apple's defaults write
, relinking python with ln -sf
, simply setting an alias python=python2.7
, to no effect. 我尝试使用Apple的
defaults write
来改回它,用ln -sf
链接python,简单地设置一个alias python=python2.7
,没有效果。
Then I tried removing python3 with conda, but conda remove python3
won't do the trick. 然后我尝试用conda
conda remove python3
,但conda remove python3
不会做的伎俩。 Searching for packages produces this: 搜索包产生了这个:
$ conda search python
Fetching package metadata: ..
(...)
python 1.0.1 0 defaults
(...)
. 2.7.5 2 defaults
. 2.7.5 3 defaults
(...)
* 3.4.1 0 defaults
I also looked up Continuum docs, and they recommend leaving 2.7 as standard and using an Anaconda environment if I want to use a different version, which doesn't help me. 我也查了一下Continuum文档,如果我想使用不同的版本,他们建议将2.7作为标准并使用Anaconda环境,这对我没有帮助。
Does anybody have any idea of how to change default version back to 2.7? 有没有人知道如何将默认版本更改回2.7?
(Specs are: anaconda 1.7.0, osx 10.8.5, conda 3.5.2) (规格为:anaconda 1.7.0,osx 10.8.5,conda 3.5.2)
Alright, I found a similar problem in the Continuum mailing list. 好吧,我在Continuum邮件列表中发现了类似的问题。
This was solved by re-installing python through conda 通过conda重新安装python解决了这个问题
$ conda install python=2.7
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0 135 KB
pycosat-0.6.1 | py27_0 57 KB
python-2.7.6 | 2 16.5 MB
pyyaml-3.11 | py27_0 149 KB
requests-2.3.0 | py27_0 564 KB
------------------------------------------------------------
Total: 17.4 MB
The following packages will be UN-linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py34_0
pycosat-0.6.1 | py34_0
python-3.4.1 | 0
pyyaml-3.11 | py34_0
requests-2.3.0 | py34_0
The following packages will be linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0 hard-link
pycosat-0.6.1 | py27_0 hard-link
python-2.7.6 | 2 hard-link
pyyaml-3.11 | py27_0 hard-link
requests-2.3.0 | py27_0 hard-link
Proceed ([y]/n)?
This can also be used to change which is the default package under anaconda environments: 这也可用于更改anaconda环境下的默认包:
$ conda install python=3.4
Fetching package metadata: ..
Solving package specifications: .
Package plan for installation in environment /Users/kadu/anaconda:
The following packages will be UN-linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py27_0
pycosat-0.6.1 | py27_0
python-2.7.6 | 2
pyyaml-3.11 | py27_0
requests-2.3.0 | py27_0
The following packages will be linked:
package | build
---------------------------|-----------------
conda-3.5.2 | py34_0 hard-link
pycosat-0.6.1 | py34_0 hard-link
python-3.4.1 | 0 hard-link
pyyaml-3.11 | py34_0 hard-link
requests-2.3.0 | py34_0 hard-link
Proceed ([y]/n)?
However, this would require manually changing the builds to any other packages you use. 但是,这需要手动将构建更改为您使用的任何其他包。 I had to reinstall spyder, which seems to have caused the bug in the first place and was presumably reinstalled when I tried to launch it under the wrong version.
我不得不重新安装Spyder,这似乎首先导致了这个bug,当我尝试在错误的版本下启动它时,可能会重新安装。 All the other libraries, which I didn't try to reinstall, are still working fine under 2.7.
我没有尝试重新安装的所有其他库在2.7下仍然可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.