Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
961 views
in Technique[技术] by (71.8m points)

python - Error: No module named 'fcntl'

I get the following error:

Traceback (most recent call last):
  File "C:/Users/aaaa/Desktop/ttttttt.py", line 5, in <module>
   import reload
  File "C:UsersaaaAppDataLocalProgramsPythonPython36libsite-
packages
eload.py", line 3, in <module>
    import sys, time, re, os, signal, fcntl
ModuleNotFoundError: No module named 'fcntl'

So I did a pip install, which also gets an error.

    C:Usersaaaa>pip install fcntl
    Collecting fcntl
      Could not find a version that satisfies the requirement fcntl (from versions: )
No matching distribution found for fcntl

Search results cPython, hacking, routing and many other words are coming out.

It's a tough answer for beginners, so I want to get a more detailed solution.

How should I solve it?

#py3
import time
from selenium import webdriver
import codecs
import sys
import reload
import re
import fcntl
import os
import signal
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The fcntl module is not available on Windows. The functionality it exposes does not exist on that platform.

If you're trying to lock a file, there are some other Python modules available which provide that functionality. One I've seen referenced in other answers is portalocker.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...