问题

python 项目运行时,抛出 ModuleNotFoundError: No module named ‘fcntl’

解决方法:

在 python 安装目录 中 Lib目录( 比如: C:\Python\Python36\Lib ),创建 fcntl.py ,内容如下:

def fcntl(fd, op, arg=0):
    return 0

def ioctl(fd, op, arg=0, mutable_flag=True):
    if mutable_flag:
        return 0
    else:
        return ""

def flock(fd, op):
    return

def lockf(fd, operation, length=0, start=0, whence=0):
    return

如果运行还报错,则在项目的虚拟环境的 Lib 目录下也添加此文件。

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐