Why does py2exe stop at “running”?

被刻印的时光 ゝ 提交于 2019-12-11 12:45:29

问题


I want to create an .exe file from a .py script using py2exe under Windows 7 and Anaconda.

So I created a setup.py file:

from distutils.core import setup 
import py2exe 

setup(console=['mouseMove.py'], options = {'py2exe': {'packages': ['pyautogui']}})

Now I navigate in the Windows-CMD to the directory which "mouseMove.py" and "setup.py" exists and start:

python setup.py py2exe

In the cmd window its written "running py2exe" and it remains in this state, nothing else happens.

Does anyone know where the problem is?

Contents of mouseMove.py:

import pyautogui 
import sys 
xCoords = sys.argv[1] 
yCoords = sys.argv[2] 
pyautogui.moveTo(xCoords, yCoords) 
pyautogui.click()

回答1:


Try the below setup.py file. I hope its working.

 from distutils.core import setup
import py2exe
from distutils.filelist import findall
import os
import matplotlib
from glob import glob
matplotlibdatadir = matplotlib.get_data_path()
matplotlibdata = findall(matplotlibdatadir)
matplotlibdata_files = []
for f in matplotlibdata:
    dirname = os.path.join('matplotlibdata', f[len(matplotlibdatadir)+1:])
    matplotlibdata_files.append((os.path.split(dirname)[0], [f]))


setup(
    console=['resolution_finder.py'],
    options={
             'py2exe': {
                        'includes': ["sip", "PyQt4.QtGui","scipy.special._ufuncs_cxx"],
                        'packages' : ['matplotlib', 'pytz'],
                        'excludes': ['_gtkagg', '_tkagg'],
                        "dll_excludes": ["MSVCP90.dll"]   
                       }
            },


    data_files=matplotlib.get_py2exe_datafiles()
    #data_files=[('matplotlib.get_py2exe_datafiles()', [("Microsoft.VC120.CRT", glob(r'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x86\Microsoft.VC120.CRT\*.*'))])]

    #data_files = [("Microsoft.VC120.CRT", glob(r'C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x86\Microsoft.VC120.CRT\*.*'))]

)


来源:https://stackoverflow.com/questions/37406228/why-does-py2exe-stop-at-running

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!