我在 Windows 7 64 位、python 2.7.9 x64 的虚拟环境中运行应用引擎应用程序。
这是堆栈跟踪:
p_system = platform.system()
File "C:\Python27\lib\platform.py", line 1310, in system
return uname()[0]
File "C:\Python27\lib\platform.py", line 1206, in uname
release,version,csd,ptype = win32_ver()
File "C:\Python27\lib\platform.py", line 597, in win32_ver
import _winreg
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\sandbox.py", line 945, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named _winreg
但是,它在 cli (在 venv 之外)上工作得很好:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Admin>python
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import _winreg
>>> import platform
>>> platform.system()
'Windows'
>>>
为什么会这样?我能做些什么来解决这个问题?