1
I’m trying to compile with py2exe
, but when I compile from error.
Let me give you an example of this error, with Python 2.7 64-bit programs, pyqt4 for Python 2.7, and py2exe
for Python 2.7.
Follow the example:
Create a file teste.py
bodily:
import sys
from PyQt4 import QtGui, uic
Create a file setup.py
with the body:
from distutils.core import setup
import py2exe
setup(console=['teste.py'])
Afterwards Compile:
python setup.py py2exe
And the error occurs:
error: compiling
'C:\Python27\lib\site-packages\PyQt4\uic\port_v3\proxy_base.py' failed
SyntaxError: invalid syntax <proxy_base.py, line 26>
It now gave the following error: error: [Errno 2] No such file or directory: 'MSVCP90.dll'
– Mega Anim
You have the Microsoft Visual C++ Compiler for Python 2.7 installed? If not, you need to install and put the directory
bin
VC on your PATH (the path it installs is something like:C:\Users\seu_usuario\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin
or, run at the prompt, the commandC:\Users\seu_usuario\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\vcvarsall.bat
(best solution) before generating the exe. If it works, let me know to update the answer– Gomiero
I installed the program that you suggested, I added it in the path, ran the script, and still keep complaining about MSVCP90.dll
– Mega Anim
I figured out how to solve the problem, so remove the dll when compiling like this: setup(options = {"py2exe": { "dll_excludes": ["MSVCP90.dll"]}}, console=['test.py.'])
– Mega Anim
Now I tried to compile the complete code, the complete compilation, but at the time of opening the program the following error: Import Error: No module named Qtnetwork
– Mega Anim
I’ve been doing some research and discovered more options, now I’m improving the compiler code: setup(options = {"py2exe": { "dll_excludes": ["MSVCP90.dll"], "includes":["Sip", "Pyqt4", "Pyqt4.Qtnetwork", "Pyqt4.Qtwebkit"]}}, console=['program.py']) However it is still complaining No module named Qtwebkit.Qwebview
– Mega Anim
Has an answer here in the OS (in English) talking about this error. And another here saying to confirm that Qt is installed with Webkit and that there is a Qt library in the path
C:\python2.7\site-packages\PyQt4
. Maybe it’ll help!– Gomiero
Inside the folder C: Python27 Lib site-Packages Pyqt4 Sip Pyqt4 Qtwebkit there is a file called qwebview.Sip, but I don’t know how it helps to know this
– Mega Anim
@Megaanim in the post, the author refers to the Linux system library, with extension
so
. In Windows, it probably should be a filedll
.– Gomiero
but Voce saw what I said? With normal python works the component.. When I do & #Xa;python program.py the program works, the qwebview component opens normal. The error only gives when compiling the program with py2exe
– Mega Anim
In linux there is something like py2exe, this is only for windows, so I don’t see what would help something that has to do with linux, in a compiler that has only for windows
– Mega Anim
@Megaanim Really, the
py2exe
is unique to the Windows platform. However, to generate a portable exe, thepy2exe
need to put all program dependencies (dlls, modules, etc.) inside the exe file. What is probably happening is that the executable is not finding any library (or module) needed for the execution.– Gomiero
This I had already understood, as you can see my comments above I include, Sip, Pyqt4, and Pyqt4.Qtnetwork, and Pyqt4.QtWebKit.. What else I have to include, that’s my doubt
– Mega Anim
@Megaanim The problem you presented in question Original was solved, right? Please, if you have any questions, ask a new question about the problem that appeared later, with details and everything you tried
– Gomiero
And then you got it? I’m reading the comments and the subject died...
– LCarvalho