When I type python
into a terminal, it responds with
当我在终端中键入python时,它会响应
zsh: permission denied: python
It seems like python3 is the main installed python version - that's what is installed into usr/bin
. Every tutorial I see says to type python
and it shows you the version of python3 that is installed. So, why would this command not work? Do I need to set the alias of python
to point to python3?
看起来,python3是安装的主要版本--这就是安装到usr/bin中的版本。我看到的每个教程都说要输入python,它会向您显示已安装的python3版本。那么,为什么这个命令不起作用呢?我需要将python的别名设置为指向python3吗?
Here is the output of some commands in my terminal, for clarity:
为了清楚起见,以下是我的终端中的一些命令的输出:
stephen@Stephens-MBP 3rd % python -V
zsh: permission denied: python
stephen@Stephens-MBP 3rd % python2 -V
zsh: command not found: python2
stephen@Stephens-MBP 3rd % python3 -V
Python 3.9.6
stephen@Stephens-MBP 3rd % pyenv versions
system
* 2.7.18 (set by /Users/stephen/.pyenv/version)
3.9.10
stephen@Stephens-MBP 3rd % python
zsh: permission denied: python
stephen@Stephens-MBP 3rd % type python
python not found
更多回答
What does type python
say?
类型蟒蛇是怎么说的?
@Barmar type python
says python not found
@Barmar TYPE PYPHON称未找到PYTHON
Do you have a file named python
in your directory?
您的目录中是否有一个名为python的文件?
in usr/bin there is only a file named python3
. Which I'm confused about - shouldn't there be a file named python
?
在usr/bin中,只有一个名为python3的文件。这让我感到困惑--难道不应该有一个名为python的文件吗?
I would care first about the python not found than on the permission problem. First of all, which Python would you like to be executed when just typing python
? Can you run this Python of your longing by specifying the explicit path name?
我首先关心的是找不到的蟒蛇,而不是权限问题。首先,当您只输入python时,您希望执行哪一个Python?您是否可以通过指定显式路径名来运行您所渴望的这个Python?
优秀答案推荐
After executing the "pyenv versions" command, proceed with the following steps:
执行“pyenv verages”命令后,继续执行以下步骤:
pyenv global 3.9.10
You need to set up the PATH for pyenv in zsh, so add the following lines to your .zshrc file:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
EXPORT PYENV_ROOT=“$HOME/.pyenv”导出路径=“$PYENV_ROOT/bin:$PATH”val“$(pyenv init-)”
source .zshrc
python3 --version
更多回答
我是一名优秀的程序员,十分优秀!