简体   繁体   中英

Py2app error ImportError: No module named httplib2

I am trying to build a standalone application for Mac using py2app. However, I am running into a error that terminates the program. For some reason, it appears, when building this application the httplib2 module is not included. These are the commands I run

$ py2applet --make-setup main.py
$ rm -rf build dist
$ python setup.py py2app -A
$ ./dist/main.app/Contents/MacOS/main

I receive the output:

ImportError: No module named httplib2
2018-01-11 15:23:15.719 main[6162:2128478] main Error

Here is how my setup.py is orientated:

from setuptools import setup

APP = ['main.py']
DATA_FILES = ['auth', 'sales_report']
OPTIONS = {
    'argv_emulation': True,
    'packages': ['httplib2'],
    'iconfile': 'icon.icns'
}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

I have the library installed, and the script will run fine when put through manually in the terminal. Am I missing something with my setup.py file? Is it referencing from a different site-packages?

I wouldn't mention the dependency package inside OPTIONS, inside option.
I would rather mention it in packages, or install_requires, in the setup() function.
Follow this doc .

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