py2exe

在Java工程中调用Python代码

蓝咒 提交于 2019-11-29 18:02:11
Python是一门好用的脚本语言,底层基于C实现,快速且简单。使用python可以说是站在巨人肩膀上编程,使得程序员更专注于业务及逻辑,而不是被人学烂的语言工具。但是团队合作时候,就会有一些多语言编程,然后集成的问题,例如我遇到的Java和Python。为了方便非Python程序员能够使用写好的python程序,需要考虑两个方面: - 环境是否可迁移,在没有python环境的机器上如何运行。 - Java如何实现与python的交互。 环境迁移 方案一 (1) 安装python环境,写入path路径 (2) 保证pip可以正常使用,cmd切换到路径下:c:/Python27/Scripts>pip (3) pip install -r requirement.txt site-packages里面放的是第三方包。包可以通过import 引入程序中。 因此,需要提前写好requirement.txt文件,包含一堆依赖 方案二 将python打包成exe,可以在无python环境的windows环境下运行python代码。有两个工具可供使用: Py2exe: python2.7 对应0.6.9版本的py2exe,需要另外创建setup.py,且不支持win64. 具体见: python打包程序py2exe实战 PyInstaller: 推荐使用, (1)首先安装:pip install

Python - how can i hide the windows command prompt screen when the script is running?

浪尽此生 提交于 2019-11-29 16:50:01
How can i remove this black command prompt screen from the desktop when my python script is running? I made the service.py script into exe using python 2 exe. All worked fine but when the .exe is running i have a fixed command prompt which i do not want to show. service.py: #!/usr/bin/env python import os import ctypes from subprocess import Popen, PIPE def Mbox(title, text, style): ctypes.windll.user32.MessageBoxA(0, text, title, style) python_check = os.path.exists("C:/Python27/python.exe") g_check = os.path.exists("C:/dev_appserver.py") if python_check & g_check: p0 = Popen(['C:/Python27

Errors with Matplotlib when making an executable with Py2exe (Python)

◇◆丶佛笑我妖孽 提交于 2019-11-29 16:16:56
I have a problem when trying to make an executable with a Python application. For doing this, I'm using Py2exe with the 2.7 version of Python. My application have 3 python scripts -> IHM_monotone_flux_GTC.py which is the one who launch a graphical interface and then 2 others scripts: -> lectureDonnees.py -> main.py In order to create an executable I made a setup.py file which is surely incomplete: from distutils.core import setup import py2exe setup(windows=['IHM_monotone_flux_gtc.py']) Unfortunetaly, it doesn't work and I got this error message: Traceback (most recent call last): File "IHM

Py2exe isn't copying webdriver_prefs.json into builds

青春壹個敷衍的年華 提交于 2019-11-29 15:22:34
I'm using py2exe to compile a Python 2.7 script that uses Selenium 2.39.0 to open up Firefox windows and carry out some routines. In the past, I've been able to compile the code without any issue. Today though, after updating from Selenium 2.35 to 2.39, I'm running into trouble. When I try to run the .exe generated by the compiled code, I get the following error: Exception in Tkinter callback Traceback (most recent call last): File "Tkinter.pyo", line 1410, in __call__ File "literatureonlineapi2.5.5.py", line 321, in startapi File "selenium\webdriver\firefox\webdriver.pyo", line 43, in __init_

How to stop Python program compiled in py2exe from displaying ImportError: No Module names 'ctypes'

折月煮酒 提交于 2019-11-29 12:38:28
I was wondering if this might be a compilation error or if there is something I can do to stop it from displaying. I have made an argparse program for cmd. I compiled it with py2exe and when I run it, it exacutes the program properly but always gives this error before running the code: Traceback (most recent call last): File "boot_common.py", line 46, in <module> ImportError: No module named 'ctypes' If it is something in my code, here is my script: import argparse import zipfile import os from contextlib import closing def parse_args(): parser = argparse.ArgumentParser('ziputil '+\ '-m <mode>

Using bundle_files = 1 with py2exe is not working

十年热恋 提交于 2019-11-29 12:27:21
问题 After some big frustration I did it! I converted my django app to an "exe" one to run as a single standalone app on windows (using cherrypy as a WSGI server) But When I try to to set py2exe's option "bundle_files" to "1" (i.e. bundle the python interpreter Python25.dll inside the generated exe) the generated exe crashes with a message talking about kernel32.dll But when I use "bundle_file" = "2" , the generated exe is runing like a charm, but must -of course- have Python25.dll as a separate

Py2Exe: DLL load failed

若如初见. 提交于 2019-11-29 11:19:37
问题 When trying to use py2exe to convert a simple Python game I made into exe format, it gave me the following error: Traceback (most recent call last): File "C:\Users\Tali\Desktop\2exe.py", line 4, in <module> setup(console=['test.py']) File "C:\Python\lib\distutils\core.py", line 152, in setup dist.run_commands() File "C:\Python\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "C:\Python\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "C:\Python

ImportError: no module named py2exe

回眸只為那壹抹淺笑 提交于 2019-11-29 09:28:45
I get this error when I try to use one of the py2exe samples with py2exe. File "setup.py", line 22, in ? import py2exe ImportError: no module named py2exe I've installed py2exe with the installer, and I use python 2.6. I have downloaded the correct installer from the site (The python 2.6 one.) My path is set to C:\Python26 and I can run normal python scripts from within the command prompt. Any idea what to do? Thanks. Edit: I had python 3.1 installed first but removed it afterwards. Could that be the problem? Sounds like something has installed Python 2.4.3 behind your back, and set that to be

PyQt/PySide - icon display

人走茶凉 提交于 2019-11-29 09:08:27
问题 I have a PySide app which has an icon for the MainWindow (a QMainWindow instance). When I run the file normally, the icon is visible and everything is fine but when I create an exe with py2exe , the icon does not appear. This happens with cx_freeze also( so I don't think the problem's with py2exe ). The app was designed using QtDesigner and converted to python with pyside-uic . I tried both using icons as a file and as a resource(qrc file) and both don't seem to work. Any help or pointers

Getting py2exe to work with zope.interface

泄露秘密 提交于 2019-11-29 04:51:23
I have a Python app based on Twisted and PyGTK. Twisted itself depends on zope.interface, and I don't import it directly. Unfortunately, when I try to run my app, the following error ends up in the error log: Traceback (most recent call last): File "tasks.py", line 4, in <module> File "ui\__init__.pyc", line 14, in <module> File "twisted\python\log.pyc", line 17, in <module> ImportError: No module named zope.interface Traceback (most recent call last): File "tasks.py", line 4, in <module> File "ui\__init__.pyc", line 14, in <module> File "twisted\python\log.pyc", line 17, in <module>