【发布时间】: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