简体   繁体   English

ipython使用错误的python版本与anaconda

[英]ipython uses wrong python version with anaconda

After activating my anaconda Python 3.6 environment with 激活我的anaconda Python 3.6环境后

source activate py36

if I type 如果我打字

python

I go into python 3.6, as expected. 正如预期的那样,我进入了python 3.6。 But if I type 但如果我输入

ipython

I go into an ipython environment based python 3.5.5, which is the same python version I get using 我进入了基于python 3.5.5的ipython环境,这与我使用的python版本相同

source activate base

and then 然后

python

How can I get into an ipython environment using my anaconda-supplied python 3.6 interpreter? 如何使用我的anaconda提供的python 3.6解释器进入ipython环境? I have updated my anaconda environment with 我更新了我的anaconda环境

conda update anaconda

and

conda update conda

Doing so does not help. 这样做没有用。

EDIT: 编辑:

I hadn't realized that I had to install ipython separately for the python 3.6 environment; 我没有意识到我必须单独为python 3.6环境安装ipython; I'd thought it was a default part of anaconda. 我以为它是anaconda的默认部分。 So 所以

conda install ipython

after

source activate py36

did the trick. 做了伎俩。 It doesn't seem optimal that after activating a particular environment, ipython may bring up a completely different anaconda-based environment. 在激活特定环境后, ipython可能会带来一个完全不同的基于anaconda的环境。 I'd prefer it to simply cause a "command not found" error. 我更喜欢它只是导致“找不到命令”错误。 Bringing up the wrong environment without making it very obvious that that is happening could lead to confusion or problems. 在不明显发生这种情况的情况下,提出错误的环境可能会导致混乱或问题。

I hadn't realized that I had to install ipython separately for the python 3.6 environment; 我没有意识到我必须单独为python 3.6环境安装ipython; I'd thought it was a default part of anaconda. 我以为它是anaconda的默认部分。 So 所以

conda install ipython

after

source activate py36

did the trick. 做了伎俩。

Have you done hash -r since entering the conda environment? 你进入conda环境后,你做过hash -r吗? Bash can cache paths to executables, so sometimes it doesn't use the one reported by which. Bash可以缓存可执行文件的路径,因此有时它不会使用报告的可执行文件。 Running hash -r resets the cache 运行hash -r重置缓存

Maybe you need also to update ipython conda update ipython 也许你还需要更新ipython conda update ipython

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

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