我的python版本有问题。我直接从网站下载并安装了最新版本的 python 3.9.0,但是当我使用 python --version 命令从终端检查版本时,安装了 2.7.16 并安装了 PIP 包管理器,我得到了这个回复:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Downloading pip-20.2.4-py2.py3-none-any.whl (1.5 MB)|████████████████████████████████| 1.5 MB 1.7 MB/s
Installing collected packages: pip
WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/user/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.2.4
[编辑](感谢@JohnVargo)
Big Sur
uses zsh
默认情况下,因此您必须修改.zprofile
输入/输出.bash_profile
。
...除非您更改了默认使用bash
,然后执行以下操作:
[/edit]
如果你想使用python
推出python3
从命令行,您可以转到主目录并编辑~/.bash_profile
添加以下行:
在终端类型中$ which python
这将返回系统的路径python2
口译员;我们称之为path_to_p2
在终端类型中$ which python3
这将返回系统的路径python3
口译员;我们称之为path_to_p3
export PATH=path_to_p3:$PATH
alias python3=path_to_p3
alias python=path_to_p3
export PATH=path_to_p2:$PATH
alias python2=path_to_p2
保存,重新启动终端;您现在可以启动python3
与任一python
, or python3
, and python2
with python2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)