[英]How to replace python 2.7.16 to python 3?
MacBook-Pro:~ bsr$ pip install django
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. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: django in ./Library/Python/2.7/lib/python/site-packages (1.11.29)
Requirement already satisfied: pytz in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from django) (2013.7)
Due this error unable to install the djengo.由于此错误无法安装 djengo。
pip install django
On the command line, run在命令行上,运行
$ python3
If you see an output like:如果您看到 output 像:
Python 3.8.0 (default, Apr 4 2020, 13:56:23)
then you have both Python 3 and 2 installed in your machine.那么您的机器中同时安装了 Python 3 和 2。 This means that you need to run
pip3 install django
.这意味着您需要运行
pip3 install django
。
If not, then:如果没有,那么:
you can reinstall Python from the official website你可以从官网重新安装Python
you can build Python from source您可以从源代码构建 Python
you can use this command (from Fareed Alnamrouti's answer in Updating Python on Mac ):您可以使用此命令(来自 Fareed Alnamrouti 在 Mac 上更新 Python 中的回答):
$ brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.