【问题标题】:/usr/bin/python3: bad interpreter; how to make python3 work again?/usr/bin/python3:错误的解释器;如何让python3再次工作?
【发布时间】:2020-03-14 04:38:53
【问题描述】:

我安装了两个版本的 python(python - 2.7.12 和 python3 - 3.5.2)。安装 python 3.7.7 后,我想通过创建一些命令使其成为 python3 命令的默认值。但不幸的是,python3 命令不再起作用!

fogang@FF:~$ python
Python 2.7.12 (default, Oct  8 2019, 14:14:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
fogang@FF:~$ python3.7
Python 3.7.7 (default, Mar 10 2020, 17:25:08) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
fogang@FF:~$ python3
bash: /usr/lib/command-not-found : /usr/bin/python3 : mauvais interpréteur: Aucun fichier ou dossier de ce type
fogang@FF:~$

翻译:“/usr/bin/python3: bad interpreter: No file or folder of this type”

有我的 /usr/bin

fogang@FF:/usr/bin$ ls python*
python     python2.7-config  python3.5-config   python3.7         python3.7m-config  python3m-config  pythontex3
python2    python2-config    python3.5m         python3.7-config  python3-config     python-config
python2.7  python3.5         python3.5m-config  python3.7m        python3m           pythontex

【问题讨论】:

  • type python3 说什么?
  • /usr/bin 中没有 python3
  • alias python3="python3.7" 放入您的 .bashrc 并重新加载 bash。
  • type python3 say 错误的解释器
  • /usr/bin/python3 不存在,那么您期望会发生什么?这怎么发生的? - 即您专门运行了哪些命令?您使用的是什么操作系统?如果您运行的是 Ubuntu,则只需 sudo ln -s python3.5 /usr/bin/python3

标签: python


【解决方案1】:

/usr/bin/python3 丢失。根据 cmets,您使用的是 Ubuntu,因此解决方案是简单地恢复它:

sudo ln -s python3.5 /usr/bin/python3

注意changing the system python3 version on Ubuntu will break things,所以更好的解决方案是使用alias,例如将alias python3="python3.7" 放入你的 bashrc。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-12
    • 2011-12-01
    • 2021-11-09
    • 1970-01-01
    • 2018-02-15
    • 2022-08-24
    相关资源
    最近更新 更多