linux – 提示括号(myenv)$似乎在最新的conda中消失了
作者:互联网
提示括号(myenv)$似乎在最新的conda中消失.
现在的情况:
john@myPC:~$conda activate myenv
john@myPC:~$
它应该是:
john@myPC:~$conda activate myenv
(myenv) john@myPC:~$
到目前为止我尝试过但失败了.
解决方案A:
$conda config // init .condarc file
$conda config --set changeps1 True
然后重新登录bash,不工作
解决方案B:
put `changeps1: true` in `.condarc` file
解决方案C:
put `export CONDA_CHANGEPS1=true` in `.bashrc`
请给我一些建议.
操作系统:ubuntu 18.04
Anaconda安装程序:64-Bit (x86) Installer – Anaconda3-2018.12-Linux-x86_64.sh
终端:GNU bash,版本4.4.19
这是我的conda信息
$rm ~/.condarc
$conda init --dry-run -vv
DEBUG conda.gateways.logging:set_verbosity(150): verbosity set to 2
DEBUG conda.gateways.subprocess:subprocess_call(48): executing>> /home/{user}/anaconda3/bin/python --version
/home/{user}/.bashrc
---
+++
@@ -129,7 +129,7 @@
\eval "$__conda_setup"
else
if [ -f "/home/{user}/anaconda3/etc/profile.d/conda.sh" ]; then
- . "/home/{user}/anaconda3/etc/profile.d/conda.sh"
+# . "/home/{user}/anaconda3/etc/profile.d/conda.sh" # commented out by conda initialize
CONDA_CHANGEPS1=false conda activate base
else
\export PATH="/home/{user}/anaconda3/bin:$PATH"
@@ -150,3 +150,19 @@
##############################
export PATH=/usr/local/cuda-9.2/bin:/usr/lib/nvidia-396:${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/lib/nvidia-396:/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
+
+# >>> conda initialize >>>
+# !! Contents within this block are managed by 'conda init' !!
+__conda_setup="$('/home/{user}/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
+if [ $? -eq 0 ]; then
+ eval "$__conda_setup"
+else
+ if [ -f "/home/{user}/anaconda3/etc/profile.d/conda.sh" ]; then
+ . "/home/{user}/anaconda3/etc/profile.d/conda.sh"
+ else
+ export PATH="/home/{user}/anaconda3/bin:$PATH"
+ fi
+fi
+unset __conda_setup
+# <<< conda initialize <<<
+
no change /home/{user}/anaconda3/condabin/conda
no change /home/{user}/anaconda3/bin/conda
no change /home/{user}/anaconda3/bin/conda-env
no change /home/{user}/anaconda3/bin/activate
no change /home/{user}/anaconda3/bin/deactivate
no change /home/{user}/anaconda3/etc/profile.d/conda.sh
no change /home/{user}/anaconda3/etc/fish/conf.d/conda.fish
no change /home/{user}/anaconda3/shell/condabin/Conda.psm1
no change /home/{user}/anaconda3/shell/condabin/conda-hook.ps1
no change /home/{user}/anaconda3/lib/python3.7/site-packages/xonsh/conda.xsh
no change /home/{user}/anaconda3/etc/profile.d/conda.csh
modified /home/{user}/.bashrc
==> For changes to take effect, close and re-open your current shell. <==
john@myPC:~$conda info
active environment : base
active env location : /home/john/anaconda3
shell level : 1
user config file : /home/john/.condarc
populated config files :
conda version : 4.6.8
conda-build version : 3.17.6
python version : 3.7.1.final.0
base environment : /home/john/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/john/anaconda3/pkgs
/home/john/.conda/pkgs
envs directories : /home/john/anaconda3/envs
/home/john/.conda/envs
platform : linux-64
user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 Linux/4.15.0-46-generic ubuntu/18.04.2 glibc/2.27
UID:GID : 1000:1000
netrc file : None
offline mode : False
john@myPC:~$conda config
john@myPC:~$cat .condarc
{}
john@myPC:~$conda activate myenv
john@myPC:~$conda info
active environment : molhack
active env location : /home/john/anaconda3/envs/molhack
shell level : 2
user config file : /home/john/.condarc
populated config files :
conda version : 4.6.8
conda-build version : 3.17.6
python version : 3.7.1.final.0
base environment : /home/john/anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/linux-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/john/anaconda3/pkgs
/home/john/.conda/pkgs
envs directories : /home/john/anaconda3/envs
/home/john/.conda/envs
platform : linux-64
user-agent : conda/4.6.8 requests/2.21.0 CPython/3.7.1 Linux/4.15.0-46-generic ubuntu/18.04.2 glibc/2.27
UID:GID : 1000:1000
netrc file : None
offline mode : False
john@myPC:~$conda config --set changeps1 True
john@myPC:~$cat ~/.condarc
changeps1: true
john@myPC:~$
//
// (myenv)john@myPC:~$are missing
//
解决方法:
conda init的输出很奇怪.在正确配置的安装中,它应该不会显示任何更改,但是您的安装表明它会改变您的.bashrc.您可以尝试让conda init完成其工作,但是,建议的更改似乎表明这将导致多个Conda管理区域.相反,我会尝试
>备份.bashrc
>从.bashrc中删除任何Conda管理的部分.此外,请确保您没有任何将/ home / {user} / anaconda3 / bin添加到路径的部分(根据v4.4 recommendations).
>运行conda init -vv.国旗就在那里看它的作用.
>开始一个新的bash shell.
标签:bash,linux,anaconda,conda,ubuntu-18-04 来源: https://codeday.me/bug/20190710/1424238.html