将 python2.7 转换为 python3 脚本时需要一些建议
我正在尝试将 python 脚本从 raspbianstretch 上的 python 2.7.x 重写为 raspbian bullseye 上的 python 3.9.x,并且我已经检查了stretch 上安装了哪些 python 模块以及与 python 相关的所有 deb 包。
所以原始脚本是这样开始的:
import socket, struct, fcntl, subprocess, sys, time, os, IN, pygame
from random import randrange
我已经设法找到并更改所有其他模块名称以对应 python3,但我仍然找不到合适的模块 ---> 有人可以帮我解决这个问题吗
,因为我不是程序员,这对我来说很新。
在安装脚本的 Debian Stretch 上,我已经使用 dpkg -L|grep python 检查了所有 python 软件包,并在 bullseye 上安装了适合 python3 的软件包。 我还完成了 pip list 和 pip freeze 来检查 debian strech 中有哪些模块,以便在 debian bullseye 中安装所有模块,但现在 bullseye 具有相同的模块,但我仍然无法运行此脚本:(
第 1 行, 导入套接字、结构、fcntl、子进程、系统、时间、操作系统、IN、pygame ModuleNotFoundError:没有名为“IN”的模块,
谢谢您的帮助
I'm trying to rewrite python script from python 2.7.x on raspbian stretch to python 3.9.x on raspbian bullseye and i already check what python modules and all deb packages related to python are installed on stretch.
so original script is starting like that :
import socket, struct, fcntl, subprocess, sys, time, os, IN, pygame
from random import randrange
I already manage to find and change all other modules names to correspond python3 but I still can not find a proper module to ---> IN
Can someone help me with this as i'm not a programmer and this is quite new to me.
on Debian stretch where script is installed I already checked all python packages with dpkg -L|grep python and i installed a proper ones for python3 on bullseye.
I also done pip list and pip freeze to check what modules are in debian strech to install all in debian bullseye but now bullseye have same modules and i still can not run this script :(
line 1, in
import socket, struct, fcntl, subprocess, sys, time, os, IN, pygame
ModuleNotFoundError: No module named 'IN'
thx for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我通过使用一些脚本来查找我在 stackoverflow 上找到的 python 模块,在 debianstretch 中找到了这个模块
,结果是:
现在我不知道如何将这样的 IN.pyc 安装到 python3 中,因为我找不到python3 类似的东西。
我认为这是 python2.7 安装的一部分,现在它不包含在 python3 中,对吧?
so i located this module in debian stretch by using some script to find python module that i found on stackoverflow
and the results is :
and now i don't know how to install something like this IN.pyc in to python3 as I can not find something like that for python3.
I assume that this was a part of python2.7 installation and now it is not included in python3 right ?