1

为什么无法访问_winreg模块jython

c:\>python  
Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.  
import _winreg  

c:\>jython  
Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_31
Type "help", "copyright", "credits" or "license" for more information.  
import _winreg  
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named _winreg
4

1 回答 1

1

_winreg在 Jython 中不可用。

在 Windows 上的 CPython 中_winreg,是编译到 Python 解释器中的内置模块(镜像底层 Windows API)。这可以通过检查sys.builtin_module_names属性来验证。

另请参见_winreg 的 Python 替代方案

于 2015-06-08T15:39:19.953 回答