2017-08-26 12 views
1

我試圖將模塊idnadata添加到cx_Freeze; idnadata存在IDNA文件夾:沒有名爲idnadata的模塊

C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\Lib\site-packages\idna 

我用下面的代碼在setup.py:

from cx_Freeze import setup, Executable 
packages = ['idnadata'] 
include_files = ['C:\\Users\\seyed_vahid\\AppData\\Local\\Programs\\Python\\Python36\\Lib\\site-packages\\idna'] 
setup(name = "instagram", 
    version = "1.0", 
    description = "test", 
    options = {'build_exe': {'packages':packages, 
     'include_files':include_files}}, 
    executables = [Executable("instagram.py")], 
) 

我跑通過的setup.py:

python setup.py build 

但我得到的錯誤如下:

ImportError: No module named 'idnadata' 

如何解決?

+0

驗證 C:\用戶\ seyed_vahid \應用程序數據\本地\程序\ Python的\ Python36 \ LIB \站點包\ IDNA是路徑。 –

回答

0

idna本身已被添加,但由於某些原因,idnadata模塊被遺漏。包括idna.idnadata解決這個

from cx_Freeze import setup, Executable 
import sys 


#main 
exe = Executable(script="instagram.py", icon="instagram.ico", base="Win32GUI") 
buildOptions = dict(excludes = ["tkinter"], includes =["idna.idnadata"], optimize=1) 
setup(name = "instagram",version = "1.0", description = "test", executables = [exe], options = dict(build_exe = buildOptions))