I'm not entirely sure I understand your question, but I'll have a crack at answering it anyway ...
Unfortunately, while you can import from a zipfile by adding it to sys.path
:
sys.path
contains a list of strings providing search locations for
modules and packages. It is initialized from the PYTHONPATH
environment variable and various other installation- and
implementation-specific defaults. Entries in sys.path
can name
directories on the file system, zip files, and potentially other
“locations” (see the site
module) that should be searched for modules,
such as URLs, or database queries. Only strings and bytes should be
present on sys.path
; all other data types are ignored. The encoding of
bytes entries is determined by the individual path entry finders.
source: http://docs.python.org/3/reference/import.html#path-entry-finders
... that doesn't extend to .pyd
and .dll
files:
Any files may be present in the ZIP archive, but only files .py
and
.py[co]
are available for import. ZIP import of dynamic modules (.pyd
,
.so
) is disallowed.
source: http://docs.python.org/3/library/zipimport.html
I'm not aware of any way of working around this restriction.