简体   繁体   中英

Module fails to import when installing from github repo as egg in pip

I have created a repo based on this gist in order to use the functionality in my own applications.

I added a setup.py . Then installed with:

pip install -e git+https://github.com/vulcan25/plugable-api#egg=plugable-api

The gist has some boilerplate in __init__.py which I will ultimately put elsewhere in my application:

from .base import the_api

...so I deleted this file, then renamed base.py to __init__.py hoping that this would allow me to to do the following in my application.

from plugable_api import the_api

This gave an import error, so I tried renaming this file again to plugable-api.py based on the fact that setup.py contains: modules=['plugable_api'], but still I get the same import error:

ModuleNotFoundError: No module named 'plugable_api'

Can someone tell me what I've missed here?

Doh, knew it would be something obvious.

renaming this file again to plugable-api.py

Should have had the underscore, not hypen: plugable_api.py

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