python的fcntl模块的位置在哪里? [英] Where is the location of the fcntl module of python?

查看:351
本文介绍了python的fcntl模块的位置在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在UNIX上,但找不到fcntl模块的位置.我在Web开发中使用的是Jython,而我正在修改的现有程序需要该模块.您能给我一种导入方法还是让我的代码能够使用此模块?预先感谢!

I'm on unix but I can't find the location of the fcntl module. I'm using Jython in my web development, and the existing program that I'm modifying needs that module. Can you give me a way to import it or for my code to be able to use this module? Thanks in advance!

推荐答案

fcntl是内置模块.它不是用Python编写的,而是用C语言编写的.不幸的是,它尚未移植到Java,并且根据此错误报告,这不可能.

fcntl is a built-in module. It's not written in Python, but in C. Unfortunately, it hasn't been ported to Java, and according to this bug report, it's unlikely that it ever will be.

要回答您的问题:请在CPython源代码中,此处.

To answer your question: it's in the CPython source, here.

问题在于fcntl是特定于Unix的;您的程序从一开始就无法移植. Java完全严格地与平台无关,并且(如Jython开发人员在该错误报告中所暗示的),某些低级的事情是不可能的.您可以搜索所需的特定功能-与整个模块相比,使该功能正常运行的机会更大-但我建议您寻找解决问题的方法,而不是尝试让fcntl在Java中运行.

The problem is that fcntl is Unix-specific; your program was not portable from the start. Java is pretty strictly platform-independent, and (as the Jython developers imply in that bug report) some low-level things aren't possible. You can search about the particular functions you need — you'll might a better chance of getting that to work than the whole module – but I'd recommend looking for some way around the problem rather than trying to get fcntl to work in Java.

希望您能找到替代解决方案.

I hope you can find an alternative solution.

这篇关于python的fcntl模块的位置在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆