python 项目运行时,抛出 ModuleNotFoundError: No module named ‘fcntl’
或 抛出 module 'fcntl' has no attribute 'LOCK_UN'
解决方法:
在 python 安装目录的Lib目录下创建 fcntl.py 文件,内容如下:
#fcnt1.py
LOCK_UN=8
F_GETFD=1
FD_CLOEXEC=1
F_SETFD=2
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