新手试图运行出《Python之禅》但是失败了
import thisTraceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import this
ModuleNotFoundError: No module named 'this'
以上是我得到的结果,请问我的问题出在哪里呢?
(纯新手,还希望各位前辈可以多多指教!) 去python的idle里执行 代码发一下 系统表示没有 this 模块 首先先确保自己的电脑安装了this模块。
其次确保你运行的脚本的名字不能是this.py。 this 模块是python(PEP 20 The Zen of Python)内置模块,不需要安装 import thisThe Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!试试用 IDLE 不要用 shell 执行看看 你看是不是没下全啊 , 我这可以
你先看看这首诗吧>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>> redforce 发表于 2021-10-7 16:52
去python的idle里执行
我是在idle里执行的,一直有错误提示。但是后来有人说是我安装的问题,让我卸了重装,终于运行出来了。{:10_266:}谢谢你呀! 嘉岳呀 发表于 2021-10-7 17:06
代码发一下
我就按照网课说的输入"import this",但是我终于运行出来了,有人让我卸载了重新安装,之后还真好了!神奇。谢谢你的回复呀~ 傻眼貓咪 发表于 2021-10-7 17:29
系统表示没有 this 模块
我好纳闷这是为啥,后来请人帮我重新下载了一遍,现在能运行出来啦。计算机真复杂!谢谢你的回复~ suchocolate 发表于 2021-10-7 17:30
首先先确保自己的电脑安装了this模块。
其次确保你运行的脚本的名字不能是this.py。
电脑小白根本不知道自己是否安装了这些东西{:10_266:}但是请人重新下载了之后就好了!开心。谢谢你的回复呀。 傻眼貓咪 发表于 2021-10-7 17:53
试试用 IDLE 不要用 shell 执行看看
运行出来了!开心~ 傻眼貓咪 发表于 2021-10-7 17:52
this 模块是python(PEP 20 The Zen of Python)内置模块,不需要安装
这个不需要单独安装吗?那就奇怪了,运行不出来。我后来找人重新帮我下载了一次,现在可以运行出来了。但我至今也不知道为啥前几天不行。谢谢你的回复~{:5_109:} 柿子饼同学 发表于 2021-10-7 18:32
你看是不是没下全啊 , 我这可以
你先看看这首诗吧
谢谢你呀~我今天也运行出来了,开心。{:5_109:}
页:
[1]