在脚本中清除屏幕时收到错误
当尝试在Python中清除屏幕时,我收到此错误:
sh: symbol lookup error: /nix/store/41dj1v3qz9a5kjncpkxhmq50yg9r24dn-glibc-2.33-62/lib/libdl.so.2: undefined symbol: _dl_catch_error_ptr, version GLIBC_PRIVATE
我尝试使用以下代码修复它(没有成功):
import os
if name == 'nt':
_ = os.system('cls')
else:
_ = os.system('clear')
我当前正在replit上运行代码,这可能是它不起作用的原因吗?
When trying to clear the screen in Python, I get this error:
sh: symbol lookup error: /nix/store/41dj1v3qz9a5kjncpkxhmq50yg9r24dn-glibc-2.33-62/lib/libdl.so.2: undefined symbol: _dl_catch_error_ptr, version GLIBC_PRIVATE
I tried fixing it with the following code (without success):
import os
if name == 'nt':
_ = os.system('cls')
else:
_ = os.system('clear')
I'm currently running the code on replit, could this be the reason for it not working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,我认为你需要写
os.name
而不是name
,所以像这样
要清除屏幕,你可以用兼容的方式编写你的程序通过简要使用以下内容与所有系统一起使用,
First of all, I think you need to write
os.name
instead ofname
,So like this
To clear the screen, you can write your program in a way that is compatible with all systems by briefly using the following,
这似乎只是一个重复问题。
当我使用 'os' 进行任何操作时,都会发生这种情况。
就像 martineau 说你必须导入“replit”。
It just seems to be a replit issue.
This happens to me when using 'os' for anything.
like martineau said you gotta import 'replit'.