2013-07-08 2 views
3
내가 시도하고 실행으로 꼬인 내 응용 프로그램을 얻을 전에 pyInstaller 중에 사용하던

와 ImportError를,하지만 실행이 오류 가지고 : 그럼나 cx_Freeze 및 pyInstaller 중에

Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts/Console.py", line 27, in <module> 
    exec code in m.__dict__ 
    File "client_test.py", line 2, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/__init__.py", line 53, in <module> 
    _checkRequirements() 
    File "/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/__init__.py", line 37, in _checkRequirements 
    raise ImportError(required + ": no module named zope.interface.") 
ImportError: Twisted requires zope.interface 3.6.0 or later: no module named zope.interface. 

, 나는 나 cx_Freeze를 사용하여 시도,하지만 난 나는 실행을 짓고 있어요 곳에서 this example.

같은 'namespace_packages': ['zope']를 사용하는 경우에도 정확한 같은 오류가 발생, 내가 파이썬 인터프리터와 성공적으로 수입 zope.interface를 열 수 있습니다, 나는 easy_install를 통해 설치 한 후 pip install -U zope.interface을 실행 나중에, 어떤 효과도 없었습니다.

여기 나 cx_Freeze 내 setup.py입니다 :

import sys 
from cx_Freeze import setup, Executable 

# Dependencies are automatically detected, but it might need fine tuning. 
build_exe_options = {"excludes": ["tkinter"], 
      'namespace_packages':['zope'], 
      'append_script_to_exe':True 
} 

setup( name = "exetest", 
     version = "0.1", 
     description = "My first executable", 
     options = {"build_exe": build_exe_options}, 
     executables = [Executable("client_test.py")]) 

편집 1 :가 나는 또한 zope.interface에서 빈 __init__.py 파일을 퍼팅 시도한다는 얘기를 깜빡 했네요, 그 또한 도움이되지 않았다.

편집 2 :, 나 cx_Freeze를 사용하여 빌드 폴더의 library.zip 내부 zope.interface 거기에 내가 모듈 중 하나가 누락 생각하지 않는다,하지만 난 여전히 ImportError

를 얻을 수

Missing modules: 
? _md5 imported from hashlib 
? _sha imported from hashlib 
? _sha256 imported from hashlib 
? _sha512 imported from hashlib 
? builtins imported from zope.schema._compat 
? ctypes.macholib.dyld imported from ctypes.util 
? dl imported from OpenSSL 
? html imported from twisted.web.server 
? netbios imported from uuid 
? ordereddict imported from zope.schema._compat 
? queue imported from twisted.internet.threads 
? twisted.python._epoll imported from twisted.internet.epollreactor 
? twisted.python._initgroups imported from twisted.python.util 
? urllib.parse imported from twisted.web.server 
? win32wnet imported from uuid 
? wsaccel.utf8validator imported from autobahn.utf8validator 
? zope.i18nmessageid imported from zope.schema._messageid 
? zope.testing.cleanup imported from zope.schema.vocabulary 

편집 : 3 : 여기합니다 (..로 단축) 내 실행 파일에서 sys.path에 출력

이야

이 나 cx_Freeze의 출력에서입니다 내가 직접 zope.interface을 가져올 때 여기

['../build/exe.linux-x86_64-2.7/client_test', 
'../build/exe.linux-x86_64-2.7', 
'../build/exe.linux-x86_64-2.7/client_test.zip', 
'../build/exe.linux-x86_64-2.7/library.zip'] 

는 내가 오류입니다 :

Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts/Console.py", line 27, in <module> 
    exec code in m.__dict__ 
    File "client_test.py", line 3, in <module> 
    File "/usr/local/lib/python2.7/dist-packages/zope.schema-4.3.2-py2.7.egg/zope/__init__.py", line 1, in <module> 
    __import__('pkg_resources').declare_namespace(__name__) 
ImportError: No module named pkg_resources 

을 내 나 cx_Freeze의 setup.py에 포함되어 내에 pkg_resources를 추가 한 후, 프로그램은 build_exe_options A를 추가

+0

''packages ':''zope.interface' ''를''build_exe_options'에 추가하면 어떨까요? –

+0

이미 똑같은 오류가 발생했습니다. 나는 또한 그것을 동시에 'includes'와 'namespace_packages'에 추가했습니다. –

+0

.egg 디렉토리에 설치되어 있습니까? cx_Freeze는 때때로 계란에서 물건을 찾는 데 어려움이 있습니다 (그러나 꼬인 것으로 보입니다). –

답변

5

includespkg_resources을 추가하면 cx_Freeze에 대한 setup.py에 나타납니다. 내가 추가 'pkg_resources'에 포함하고 나 cx_Freeze 스크립트를 실행하면

+1

.spec 파일의 PyInstaller의 경우'hiddenimports' 목록에'pkg_resouces'를 넣으십시오. –

0

시도를 실행 서브 패키지의 특정 포함은 즉 "includes": ["zope.interface"],입니다.이를 포함시켜야합니다.

+0

고마워,하지만이 질문에 대한 의견에 언급되어, 나는 이미 그것을 시도했습니다. –

0

, 나는 단지이 처음 두 행을 얻을 그리고 여기 유지 :

내가 같은했다

+0

누군가 동일한 문제가 있습니까? – Maxi

+0

실제로 이것은 다음과 같습니다 : namespace_packages = [ 'zope'] – Maxi

+0

내가 이것을 includes에 추가했는데 빌드가되었지만 실행하려고하면 런타임 오류가 발생합니다 : – Maxi

2

build_exe 실행

구축 실행 cx_freeze와 관련된 문제. 위의 해결책 중 어느 것도 제 경우에는 효과가없는 것으로 보입니다. 나를 위해 는 here에서이 솔루션은 일 :

당신은 정상 처리 는 꼬마 도깨비에 의해 수행되도록 실제로 빈 파일로 zope/__init__.py을 작성해야합니다.find_module() 실제로 작동합니다

관련 문제