[英]I downloaded Python 3.9 but nothing seems to have happened
Ok, I'm trying to install python 3.9 in my computer.好的,我正在尝试在我的计算机中安装 python 3.9。 The only thing I know about computers is programming, and I'm starting with Python. I really don't understand much of anywhere before that, so that's why I couldn't get what I'm looking for in other StackOverflow questions and so on.
我对计算机的唯一了解是编程,我从 Python 开始。在那之前我真的不太了解任何地方,所以这就是为什么我无法在其他 StackOverflow 问题中找到我想要的东西,所以在。 I have a hard time in that.
我很难做到这一点。 Therefore, I'll describe exactly what I did:
因此,我将准确描述我所做的事情:
I went to https://www.python.org/ and downloaded Python 3.9 (that button in the middle).我去了https://www.python.org/并下载了 Python 3.9(中间那个按钮)。
After it finished downloading, I opened it and went through the installation window. After it was done, I went to my Terminal (after I figured out what it was) and typed which python
.下载完成后,我打开它并完成安装 window。完成后,我转到我的终端(在我弄清楚它是什么之后)并输入
which python
。 This is where the problem starts;这就是问题开始的地方; I got a pretty neutral return (just the path):
我得到了一个相当中性的回报(只是路径):
/usr/bin/python
/usr/bin/python
After that, I did python
.之后,我做了
python
。 Then there was a problem:然后有一个问题:
WARNING: Python 2.7 is not recommended.
警告:不推荐 Python 2.7。 This version is included in macOS for compatibility with legacy software.
此版本包含在 macOS 中以与旧版软件兼容。 Future versions of macOS will not include Python 2.7.
macOS 的未来版本将不包括 Python 2.7。 Instead, it is recommended that you transition to using 'python3' from within Terminal.
相反,建议您从终端内过渡到使用“python3”。
Python 2.7.16 (default, Apr 17 2020, 18:29:03) [GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin Type "help", "copyright", "credits" or "license" for more information.
Python 2.7.16(默认值,2020 年 4 月 17 日,18:29:03)[GCC 4.2.1 兼容 Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin 类型“help”, “版权”、“出处”或“许可”以获取更多信息。
All I understand is that the computer still has Python 2.7.16 installed (which, if I understand correctly, is a default for Mac), and not the 3.9.我所知道的是计算机仍然安装了 Python 2.7.16(如果我理解正确的话,这是 Mac 的默认设置),而不是 3.9。 In the tutorial I was watching, this didn't happen... What can I do?
在我观看的教程中,这并没有发生……我该怎么办?
EDIT: By the way, the commands python3.9
and python3.9.0
gave the same error message:编辑:顺便说一句,命令
python3.9
和python3.9.0
给出了相同的错误信息:
>>> python3.9
File "<stdin>", line 1
python3.9
^
SyntaxError: invalid syntax
>>> python3.9.0
File "<stdin>", line 1
python3.9.0
^
SyntaxError: invalid syntax
looks like your python is linked to python2.7 instead of python3.看起来你的 python 链接到 python2.7 而不是 python3。
just type python3 on commandline, this should solve your problem.只需在命令行上键入 python3,这应该可以解决您的问题。 you can check the version by typing python3 --version on commandline.
您可以通过在命令行中键入 python3 --version 来检查版本。
the same should work for pip3同样适用于 pip3
Errors and lines beginning with >>>
suggest you're still inside Python2 interpreter.以
>>>
开头的错误和行表明您仍在 Python2 解释器中。 You need to exit it before trying to run Python3.在尝试运行 Python3 之前你需要退出它。 You can do that by pressing the
Ctrl
and d
buttons on your keyboard at the same time, or typing exit()
.您可以通过同时按下键盘上的
Ctrl
和d
按钮,或键入exit()
来实现。
After exiting, you should be able to run python3
.退出后,您应该能够运行
python3
。
The best easy way is to use anadonda based python or intel based.最简单的方法是使用基于 anadonda 的 python 或基于 intel 的。 Anaconda based python for MacOS
Anaconda 基于 python for MacOS
This should work for you.这应该适合你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.