为什么py2exe在“运行"中停止? [英] Why does py2exe stop at "running"?
本文介绍了为什么py2exe在“运行"中停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Windows 7和Anaconda下使用py2exe从.py脚本创建.exe文件.
I want to create an .exe file from a .py script using py2exe under Windows 7 and Anaconda.
所以我创建了一个setup.py文件:
So I created a setup.py file:
from distutils.core import setup
import py2exe
setup(console=['mouseMove.py'], options = {'py2exe': {'packages': ['pyautogui']}})
现在,我在Windows-CMD中导航到"mouseMove.py"和"setup.py"存在的目录并开始:
Now I navigate in the Windows-CMD to the directory which "mouseMove.py" and "setup.py" exists and start:
python setup.py py2exe
在cmd窗口中,其编写为正在运行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?
mouseMove.py的内容:
Contents of mouseMove.py:
import pyautogui
import sys
xCoords = sys.argv[1]
yCoords = sys.argv[2]
pyautogui.moveTo(xCoords, yCoords)
pyautogui.click()
推荐答案
尝试下面的setup.py文件.我希望它能正常工作.
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\*.*'))]
)
这篇关于为什么py2exe在“运行"中停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文