此书的代码不能在win7 64位运行

嘿丶猫铑 评论 Python灰帽子 3 2013-01-15 16:17:26
nile
nile 2013-02-27 11:16:57

如果你的系统是WIN7 64位系统,而python装的是32位的,会遇到下面的问题:
调用:DebugActiveProcess(),函数返回0,使用 GetLastError() 返回错误码50, 使用 FormatMessage 处理后显示 “不支持该请求”。

我个人解决方法:
重新安装python,找64位的:
1、下载安装:
http://www.python.org/ftp/python/2.7.3/python-2.7.3.amd64.msi

2、下载安装pywin32-64位
http://jaist.dl.sourceforge.net/project/pywin32/pywin32/Build%20218/pywin32-218.win-amd64-py2.7.exe

3、安装setuptools
下载:http://peak.telecommunity.com/dist/ez_setup.py
D:\Python27_64\3rd>..\python.exe ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to d:\python27_64\lib\site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install-script.py script to D:\Python27_64\Scripts
Installing easy_install.exe script to D:\Python27_64\Scripts
Installing easy_install.exe.manifest script to D:\Python27_64\Scripts
Installing easy_install-2.7-script.py script to D:\Python27_64\Scripts
Installing easy_install-2.7.exe script to D:\Python27_64\Scripts
Installing easy_install-2.7.exe.manifest script to D:\Python27_64\Scripts

Installed d:\python27_64\lib\site-packages\setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11


3、如果你用到chardet,并安装到python27_64中
D:\Python27_64\3rd\chardet-2.1.1>..\..\python.exe setup.py install

4、配置python26_64到pydev中。

安装完毕,再次以64位lib,建立新项目,运行Ok!

Enter the pid of the process to attach to :4968
pid= 4968
self.h_process: 116
res: 1
debug....
press a key to continue...

[*] Finished debugging ,Exitting ...

嘿丶猫铑
嘿丶猫铑 2013-04-05 00:31:22

的确是这样的,不过即使换成64的python,还是有很多win32api无法正常使用

子安
子安 2013-08-29 11:27:34

谢谢提醒!

hysteria_def
hysteria_def 2013-09-08 21:20:08

差点去准备个虚拟xp了。。。

hysteria_def
hysteria_def 2013-09-08 21:33:11

万分感谢,只安了个64位python就好了

JoshuaGhost
JoshuaGhost 2015-08-14 11:41:58

多谢提醒,本来搜到那些直接用VC写的人都是把build的目标改一下就好,然后就以为是静态链接库的问题,搜到这个帖子才恍然大悟,从python到pywin一串工具链都要改成64位的