我有PyQt的代码:
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from PyQt4.QtWebKit import *
def main():
page = raw_input('Escriu una web: ')
app = QApplication(sys.argv)
view = QWebView()
view.settings().setAttribute(QWebSettings.JavascriptEnabled, True)
view.load(QUrl(page))
view.setWindowTitle('Titanicus 0.1')
view.show()
app.exec_()
if __name__ == '__main__':
main()
我的setup.py文件是这样的:
import sys
from cx_Freeze import setup, Executable
setup(
name = "On Dijkstra's Algorithm",
version = "3.1",
description = "A Dijkstra's Algorithm help tool.",
executables = [Executable("nautilus.py")])
我有文件夹构建,但是当我尝试打开新的exe文件时,它会返回错误:
File "ExtensionLoader_PyQt4_QtGui.py", line 11, in <module>
ImportError: No module named atexit
请帮忙!
答案 0 :(得分:0)
我尝试将options = {"build_exe" : {"includes" : "atexit" }}
添加到setup.py
,
REF。 https://bitbucket.org/reclosedev/cx_freeze/src/f3cacc2fd45a/samples/PyQt4/setup.py
答案 1 :(得分:0)
尝试这样的事情:
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork
class myWindow(QtWebKit.QWebView):
def __init__(self, parent=None):
super(myWindow, self).__init__(parent)
self.setWindowTitle('Titanicus 0.1')
self.settings().setAttribute(QtWebKit.QWebSettings.JavascriptEnabled, True)
page = raw_input('Escriu una web: ')
self.load(QtCore.QUrl(page))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
main = myWindow()
main.show()
sys.exit(app.exec_())