我尝试将模块idnadata添加到cx_Freeze; idnadata存在于idna文件夹中:
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 :(得分:2)
我已经解决了问题,
import akka.actor.{Props, IndirectActorProducer, Actor}
import javax.inject.Inject
import com.google.inject.Injector
class GlobalActorProducer[T <: Actor](val aClass: Class[T]) extends IndirectActorProducer {
@Inject private var injector : Injector = _
def produce(): T = injector.getInstance(aClass)
def actorClass: Class[T] = aClass
}
object GlobalActorProducer {
def apply[T <: Actor](targetClass: Class[T]): Props = Props.create(classOf[GlobalActorProducer[T]], targetClass)
}
答案 1 :(得分: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))