window7(64位)下安装pyinstall来打包成单独可执行文件

        今天想把python脚本打包成一个exe文件来发布,结果因为装的是window7,又是64位,先装了python2.6(原来是32位的),运行pyinstall时,老说找不到pywin32,下载了pywin32-216.win-amd64-py2.7,安装没有出错,但还是运行不了pyhinstall,转了大半天,认真看了pywin32原码中的说明文档,有如下介绍:

Welcome to the downloads for pywin32.
    
To download pywin32, please select the "View All Downloads" button, then 
select the installer executable for your system.  Note that there is one
download package for each supported version of Python - please check what
version of Python you have installed and download the corresponding
package.

Some packages have a 32bit and a 64bit version available - you must download
the one which corresponds to the Python you have installed.  Even if you have
a 64bit computer, if you installed a 32bit version of Python you must install
the 32bit version of pywin32.

If the installation process informs you that Python is not found in the 
registry, it almost certainly means you have downloaded the wrong version -
either for the wrong version of Python, or the wrong "bittedness".

A changelog can be found at http://pywin32.cvs.sourceforge.net/viewvc/pywin32/pywin32/CHANGES.txt?view=markup

原来python的版本要和pywin的版本一致才行,重新到python的官网下回64位的python2.7,并到sourceforge上下pywin32-216.win-amd64-py2.7安装,就搞定,哈哈

过程如下:

1.安装好pyhton2.7后,在window7上设置好环境变量PATH,主要是把python2.7的安装目录路径(你因为便能调用到python.exe解析器)和python2.7目录中的Scripts(以便 能调用到通过护展为python添加的第三方脚本,这个pywin32就是第三方脚本)护展目录路径添上,我的PAYH环境变量是这样:

C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Program Files\Python27\;D:\Program Files\Python27\Scripts\

多添的为:D:\Program Files\Python27\

                  D:\Program Files\Python27\Scripts\

 

2.之后,分别执行pyinstall的打包步骤就搞写。

你可能感兴趣的:(Python)