conda 命令会提示错误:“Bad Interpreter: No such file or directory" [英] conda command will prompt error: "Bad Interpreter: No such file or directory"

查看:32
本文介绍了conda 命令会提示错误:“Bad Interpreter: No such file or directory"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Arch linux,并且按照 Anaconda 网站上的说明安装了 Anaconda.当我尝试运行 conda info --envs 时,出现以下错误:

I'm using arch linux and I've installed Anaconda as per the instruction on the Anaconda site. When I'm attempting to run conda info --envs I get the following error:

bash:/home/lukasz/anaconda3/bin/conda:/opt/anaconda1anaconda2anaconda3/bin/python:错误的解释器:没有这样的文件或目录

bash: /home/lukasz/anaconda3/bin/conda: /opt/anaconda1anaconda2anaconda3/bin/python: bad interpreter: No such file or directory

我尝试查找目录 /opt/anaconda1anaconda2anaconda3/bin/python: 但它根本不存在.

I've tried looking for the directory /opt/anaconda1anaconda2anaconda3/bin/python: but it simply doesn't exist.

此外,当我从终端运行 python 时,它正常运行,顶部显示以下内容

Furthermore, when I run python from the terminal it runs as normal with the following displayed at the top

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

为了完整起见,我的 .bashrc 文件类似于:

for completeness my .bashrc file resembles:

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[u@h W]$ '

# added by Anaconda3 4.0.0 installer
export PATH="/home/lukasz/anaconda3/bin:$PATH"

# python startup for up keys
export PYTHONSTARTUP=$HOME/.pythonstartup

我已尝试遵循 ​​this 并进行适当的更改,但没有,我'我也尝试过 this 但确实没有已发布解决方案.

I've tried following this and making the the appropriate changes but nothing, I've also attempted to do this but there really isn't a solution posted.

我想尝试解决此问题,而无需删除 Anaconda 并重新安装.

I would like to try to fix this without having to remove Anaconda and reinstalling it.

推荐答案

我想在安装过程中一定出了问题.错误的解释器意味着脚本正在寻找不存在的解释器 - 正如您正确指出的那样.

Something must have gone wrong during the installation, I suppose. The bad interpreter means that a script is looking for an interpreter that doesn't exist - as you rightfully pointed out.

问题可能出在 conda 脚本的 shebang #! 语句中.

The problem is likely to be in the shebang #! statement of your conda script.

来自维基百科:在类 Unix 操作系统下,当一个带有 shebang 的脚本作为程序运行,程序加载器解析其余部分脚本的初始行作为解释器指令;这而是运行指定的解释器程序,并将其作为参数尝试运行时最初使用的路径脚本.

From Wikipedia: Under Unix-like operating systems, when a script with a shebang is run as a program, the program loader parses the rest of the script's initial line as an interpreter directive; the specified interpreter program is run instead, passing to it as an argument the path that was initially used when attempting to run the script.

如果你跑了

cat ~/anaconda3/bin/conda

您可能会得到以下信息:

You will probably get the following:

#!/opt/anaconda1anaconda2anaconda3/bin/python
if __name__ == '__main__':
    import sys
    import conda.cli

    sys.exit(conda.cli.main())

更改第一行以指向正确的解释器,即将其更改为:

Changing the first line to point a correct interpreter, i.e., changing it to:

#!/home/lukasz/anaconda3/bin/python

应该使 conda 命令起作用.

Should make the conda command work.

如果您确定已正确安装所有内容,那么我建议您联系 来自 anaconda 社区的支持.

If you are sure that you installed everything properly, then I'd suggest maybe reaching out for support from the anaconda community.

这篇关于conda 命令会提示错误:“Bad Interpreter: No such file or directory"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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