在 Big Sur 上的 VS Code 上无法从 Python 2.7 更改
Can't change from Python 2.7 on VS Code on Big Sur
我在 Mac 上安装了 Python 3.9,并在 VS Code 中使用 Python: Select Interpreter 进行更改。 VS Code 告诉我它在状态栏中使用 Python 3.9,但是当我在终端中键入“python -V”时,它告诉我它使用 Python 2.7。请参阅随附的屏幕截图。
screenshot
Python MacOS 中预装了 2.7。命令python
引用它。
如果您想使用 python 3.x,您必须使用 python3
(如 python3 --version
)
如果您想在键入 python
时调用 python3,您可以为 bashrc
或 zshrc
添加一个别名(取决于哪个你使用)例如
alias python="python3"
我在 Mac 上安装了 Python 3.9,并在 VS Code 中使用 Python: Select Interpreter 进行更改。 VS Code 告诉我它在状态栏中使用 Python 3.9,但是当我在终端中键入“python -V”时,它告诉我它使用 Python 2.7。请参阅随附的屏幕截图。
screenshot
Python MacOS 中预装了 2.7。命令python
引用它。
如果您想使用 python 3.x,您必须使用 python3
(如 python3 --version
)
如果您想在键入 python
时调用 python3,您可以为 bashrc
或 zshrc
添加一个别名(取决于哪个你使用)例如
alias python="python3"