简体   繁体   中英

PyInstaller - ImportError: No module named 'rethinkdb'

I compile using pyinstaller -F ./parser.spec .
Then I run the program with ./dist/parser and get this error:

Traceback (most recent call last):
  File "<string>", line 21, in <module>
ImportError: No module named 'rethinkdb'
parser returned -1

I tried to create a hook file, but to be honest I really feel like I have no idea what I'm doing.

rethinkdb is in hiddenimports but pyparser doesn't throw any errors at me indicating what might be wrong.

parser
hiddenimports = [
    'ssl',
    'cPickle',
    'pickle',
    'itertools',
    'multiprocessing',
    'builtins',
    'rethinkdb',
    'rethinkdb.ast',
    'rethinkdb.errors',
    'rethinkdb.net',
    'rethinkdb.ql2_pb2',
    'rethinkdb.query',
    'rethinkdb.version',
]
parser.spec
 ... a = Analysis( ['parser'], pathex=[os.path.realpath('./env/lib/python3.3/site-packages/')], binaries=None, datas=added_files, hiddenimports=['rethinkdb'], hookspath=[os.path.realpath('./hooks')], runtime_hooks=None, excludes=None, win_no_prefer_redirects=None, win_private_assemblies=None, cipher=block_cipher ) ... 
hooks/hook-rethinkdb.py
 hiddenimports = [ 'ssl', 'cPickle', 'pickle', 'itertools', 'multiprocessing', 'builtins', 'rethinkdb', 'rethinkdb.ast', 'rethinkdb.errors', 'rethinkdb.net', 'rethinkdb.ql2_pb2', 'rethinkdb.query', 'rethinkdb.version', ] 

I was having the same kind of trouble with an application I was making but it had an easy fix. I am not sure if it will work for you but I would at least try it because it is really easy. Instead of editing the spec file try running this in the command line:

pyinstaller --paths=C:/Users/.../Python34/Lib/site-packages filename.py

Obviously change the path to the correct path for your computer. Hopefully this helps if not I hope you can find an answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM