[Python.NET] importing eggs. does pythonnet not use respect the easy-install.pth file?

John Burkhart jfburkhart.reg at gmail.com
Fri Aug 23 13:09:02 CEST 2013


This is my current work-around

## Seems to be a required hack for pythonnet
if 'pythonnet' in sys.executable:
    try:
        import site
        site.addsitedir(r'C:\Python27\lib\site-packages')
    except:
        print sys.path


On Fri, Aug 23, 2013 at 12:51 PM, John Burkhart <jfburkhart.reg at gmail.com>wrote:

> Hello,
>
> I have a pythonnet installation that works fine for the most part.
> However, whenever I try to import a module that was built with
> easy_install, I have to explicitly add the full egg path to the sys.path
> variable. Does pythonnet not respect the easy-install.pth file?
>
> [code]
> >>> import south
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named south
> >>> import sys
> >>> sys.path.append(r'C:\Python27\lib\site-packages\south-0.8.2-py2.7.egg')
> >>> import south
> >>>
> >>> import openpyxl
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: No module named openpyxl
> >>>
> sys.path.append(r'C:\Python27\lib\site-packages\openpyxl-1.6.1-py2.7.egg')
> >>> import openpyxl
> >>>
> [/code]
>
>
> My easy-install.pth file contains:
>
> [code]
> import sys; sys.__plen = len(sys.path)
> ./python_distutils_extra-2.37-py2.7.egg
> ./openpyxl-1.6.1-py2.7.egg
> ./south-0.8.2-py2.7.egg
> import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];
> p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert =
> p+len(new)
> [/code]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20130823/37988196/attachment.html>


More information about the PythonDotNet mailing list