python - /usr/bin/python3:错误的解释器;如何让python3再次工作?
问题描述
我安装了两个版本的 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:错误的解释器:没有这种类型的文件或文件夹”
有我的 /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
解决方案
/usr/bin/python3
不见了。根据评论,您使用的是 Ubuntu,因此解决方案是简单地恢复它:
sudo ln -s python3.5 /usr/bin/python3
请注意,在 Ubuntu 上更改系统python3
版本会破坏一些东西,因此更好的解决方案是使用别名,例如放入alias python3="python3.7"
您的 bashrc。
推荐阅读
- c# - 我无法在 azure bot 默认答案中以超链接的形式编写文本,该机器人在 MS 团队中工作,但它只显示文本
- flutter - 主类中的错误:对空值使用空检查运算符
- javascript - React 渲染对象不可扩展
- aws-mediapackage - AWS Elemental MediaPackage 时移不工作 404 错误
- git - 带有自定义电源外壳合并驱动程序的“错误:add_cacheinfo 无法刷新路径”
- node.js - 忽略来自不同客户端对 Cassandra 中同一行的写入查询
- git - VS Code 1.57版(2021年5月发布)检测不到git SCM
- java - 在片段android中初始化视图元素私有
- git - 第一次推送到 Gitlab 时得到![remote denied] development -> development (pre-receive hook denied)
- autodesk-forge - 要上传到 Autodesk Forge 的文件格式