康达鱼壳不能正常工作 [英] conda not working correctly with fish shell

查看:76
本文介绍了康达鱼壳不能正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在macOS的fish shell中使用conda环境时, python 仍指向系统python( / usr / local / bin / python )而不是指向由conda环境安装的python版本(< PATH to MINICONDA> / envs /< ENV NAME> / bin / python )。其他所有内容(例如 ipython jupyter )都指向正确的路径,只是 python 的行为不符合预期。我该如何解决?

When using conda environments inside the fish shell on macOS, python still points to system python (/usr/local/bin/python) instead of pointing to the version of python installed by the conda environment (<PATH TO MINICONDA>/envs/<ENV NAME>/bin/python). Everything else (e.g. ipython, jupyter) points to the correct path, just python isn't behaving as expected. How do I fix this?

详细信息:

在macOS Mojave 10.14上按以下顺序执行以下步骤.3:

Performed the following steps in the following order on macOS Mojave 10.14.3:

  • Installed miniconda (a while back) via the bash install script
  • Installed fish using homebrew
  • Updated config.fish as per: Cannot run source activate with conda in Fish-shell

至此,我可以成功激活和停用鱼类内部的conda环境,但是正如该问题顶部所指出的那样, python 并不指向应该在哪里。其他所有内容(例如 ipython )均正常运行。

At this point I can activate and deactivate conda environments successfully inside fish, but as noted at the top of this question python doesn't point to where it should. Everything else (e.g. ipython) works correctly.

conf信息返回(与bash和鱼内部相同):

conf info returns (same inside bash and fish):

     active environment : base
    active env location : /Users/salamon/dev/miniconda3
            shell level : 1
       user config file : /Users/salamon/.condarc
 populated config files : 
          conda version : 4.6.11
    conda-build version : not installed
         python version : 3.7.1.final.0
       base environment : /Users/salamon/dev/miniconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/salamon/dev/miniconda3/pkgs
                          /Users/salamon/.conda/pkgs
       envs directories : /Users/salamon/dev/miniconda3/envs
                          /Users/salamon/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.1 Darwin/18.2.0 OSX/10.14.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False

在bash中调用哪个python

/Users/salamon/dev/miniconda3/bin/python

在鱼中:

/usr/local/bin/python

任何帮助将不胜感激。

推荐答案


python没有指向应该在哪里

python doesn't point to where it should

很简单,这意味着t帽子中有一个路径组件,在您想要的组件之前包含一个python。在这种情况下,/ usr / local / bin在$ PATH中的/ envs // bin /之前(如果在此位置)。

Quite simply, that means that there is a path component that includes a python before the one you want. In this case /usr/local/bin is before /envs//bin/ in $PATH (if it's in there at all).

请参见 command -sa python ,它应该打印所有 all pythons,并相应地调整$ PATH,可能是将所需的变量放入$ fish_user_paths中,该前缀为$ PATH。

See command -sa python, which should print all pythons it can, and adjust your $PATH accordingly, possibly by putting the one you want into $fish_user_paths, which is prepended to $PATH.

这篇关于康达鱼壳不能正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆