2015-07-11 24 views
0

我試着去球泡我與硒的應用程序,我有這個setup.py:cx_freeze +硒+蟒蛇3:無模塊名爲「httplib的」

import sys 
from cx_Freeze import setup, Executable 


path_drivers = ("C:\Python34\Lib\site-packages\PyQt5\plugins\sqldrivers\qsqlmysql.dll", "sqldrivers\qsqlmysql.dll") 

includes = ["atexit","PyQt5.QtCore","PyQt5.QtGui", "PyQt5.QtWidgets","PyQt5.QtSql", "selenium"] 
includefiles = [path_drivers] 

excludes = [ 
'_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl', 
'Tkconstants', 'Tkinter' 
] 
packages = ["os"] 
path = [] 

# Dependencies are automatically detected, but it might need fine tuning. 
build_exe_options = { 
       "includes":  includes, 
       "include_files": includefiles, 
       "excludes":  excludes, 
       "packages":  packages, 
       "path":   path 
} 

# GUI applications require a different base on Windows (the default is for a 
# console application). 
base = None 
exe = None 
if sys.platform == "win32": 
    exe = Executable(
     script="main.py", 
     initScript = None, 
     base=None, 
     targetName="zeus.exe", 
     compress = True, 
     copyDependentFiles = True, 
     appendScriptToExe = False, 
     appendScriptToLibrary = False, 
     icon = None 
    ) 

setup(
     name = "telll", 
     version = "0.1", 
     author = 'me', 
     description = "My GUI application!", 
     options = {"build_exe": build_exe_options}, 
     executables = [exe] 
) 

構建完成,沒有任何問題,但是當我運行我的應用程序:

ImportError: No module named 'httplib' 

我的配置: 的Python 3.4.3 32位。 PyQt5 硒2.46.0

Thaks的幫助

+0

嘗試增加httplib的到'packages'列表在你的setup.py –

+0

@ThomasK httplib是一個來自python2的庫,我使用python3,因爲PyQt5使用python3,但是硒需要httplib。我不知道如何解決這個問題,當我運行我的應用程序表單控制檯永恆的工作完美。 –

+0

是否有跟蹤錯誤信息?如果是這樣,你能證明嗎? –

回答

0

httplib的要麼是不是在你的目錄路徑,或尚未導入。

嘗試添加這兩種腳本代碼的:

  1. 進口httplib的
  2. httplib的= httplib的(CONFIG_FILE = 「你的目錄路徑httplib的」)
+0

問題出現了,因爲python3 selenium使用httplib2,但由於某種原因需要httplib,但在python3中完美工作。 然而當用cx_Freeze創建版本時,問題是httplib 我不知道如何解決這個問題並結束應用程序的部署。 –