2016-11-18 18 views
1

pyinstallerでPyQtアプリケーションをパッケージ化しようとしています。次のように私のsimplyfiedディレクトリツリーが見えます:pyinstaller:インポートされたモジュールから不足しているデータを追加する

maindir/ 
├── build/ 
├── dev_tool.py 
├── dev_tool.spec 
├── dist 
│   └── dev_tool/ 
└── ... 

私は.../dev_tool/langdetect/utils/messages.propertiesを見つけることができなかったというエラーが出ますdist/フォルダ

$ ./dist/dev_tool/dev_tool

から実行可能ファイルdev_toolを実行すると。しかし、私が手作業でlangdetectフォルダ(私は単にpip install langdetect -edを持っていた私のpythonサイトパッケージからコピーしました)を追加すると動作します。今私は.spec -file hereの中でファイルを定義してファイルを追加する方法について読んでいますが、langdetect/フォルダをPythonのサイトパッケージからdist/dev_tool/フォルダにコピーしようとすると、それでも動作しません。

私は私のdev_tool.specファイル

a = Analysis (... 
datas=[('path_to.../site-packages/langdetect', 'dist/dev_tool/langdetect')] 
...) 

は、サイトパッケージlangdetectフォルダからdist/dev_tool/langdetect/にこのコピーのすべてではありません万一に次の行を追加しましたか?

ここのお手伝いをさせていただきます。

答えて

0

TreeクラスはPyInstallerから使用できます。

# dev_tool.spec 
langdetect_toc = Tree('C:\\[site-packages]\\langdetect', 
         prefix='langdetect', 
         excludes=['*.py','*.pyc', '*test*']) 
a.datas += langdetect_toc 

はその後、実行時にそれらを見つけることができdist\dev_tool\langdetectのでdev_toollangdetectから必要なすべてのデータファイルを配置します引数としてdev_tool.specpyinstallerを実行しています。

0

これが私の仕事:

a = Analysis(
    # your other stuff here... 
    datas=[ 
     ('langdetect/utils', 'csg_fileutil_libs/langdetect/utils'), # for messages.properties file 
     ('langdetect/profiles', 'csg_fileutil_libs/langdetect/profiles'), 
      ] 
    # the rest of your analysis spec... 
    ) 
関連する問題