错误:没有名为' fcntl'

时间:2017-07-21 03:16:59

标签: python windows python-3.x module compiler-errors

我收到以下错误:

promise.all()

所以我做了一个pip安装,也出错了。

Traceback (most recent call last):
  File "C:/Users/aaaa/Desktop/ttttttt.py", line 5, in <module>
   import reload
  File "C:\Users\aaa\AppData\Local\Programs\Python\Python36\lib\site-
packages\reload.py", line 3, in <module>
    import sys, time, re, os, signal, fcntl
ModuleNotFoundError: No module named 'fcntl'

搜索结果cPython,黑客,路由和许多其他单词即将发布。

对于初学者来说这是一个艰难的答案,所以我想得到一个更详细的解决方案。

我该如何解决?

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

3 个答案:

答案 0 :(得分:4)

Windows上没有fcntl模块。它暴露的功能在该平台上不存在。

如果您正在尝试锁定文件,则可以使用其他一些Python模块来提供该功能。我在其他答案中引用的一个是portalocker

答案 1 :(得分:2)

您可以使用通常的方法安装importlib:

pip install importlib

从那里使用以下内容:

from importlib import reload

请注意,您将需要将导入内容加载为“模块”:

from petshop import parrot as parrot

答案 2 :(得分:1)

我从这个网站 https://pypi.org/project/micropython-fcntl/#files 获得了一些信息并按如下方式安装,解决了问题:

pip install micropython-fcntl