py2exe问题解决

用py2exe,方法如下:
1. 安装py2exe easy_install即可
2. 将打包文件与被打包文件放在同一个文件夹下
例如,你需要将test.py打包成exe,那么test.py就是被打包文件,那么打包文件呢,保存下边的文件为.py文件 (例如setup.py):
# setup.py
from distutils.core import setup
import py2exe
setup(console=["test.py"])
放在同一个目录的目的是因为在console = ["test.py"]时,不用考虑路径问题,当然,你的是什么py文件,就把名字替换了。。。
然后运行,运行命令为: python setup.py py2exe

出现错误如下:

  
  
  
  
  1. *** finding dlls needed *** 
  2. error: MSVCP90.dll: No such file or directory 

解决办法:

  
  
  
  
  1. 修改setup.py文件 
  2. # setup.py 
  3. from distutils.core import setup 
  4. import py2exe 
  5. #setup(console=["test.py"]) 
  6. setup( 
  7.     options = { 
  8.         "py2exe":{ 
  9.             "dll_excludes":["MSVCP90.dll"], 
  10.         } 
  11.     }, 
  12.     windows=[{"script":"D:/test.py"}] 

 

你可能感兴趣的:(py2exe,MSVCP90.dll)