ImportError: No module named zope.interface

前端 未结 3 1481
轻奢々
轻奢々 2021-01-04 08:24

I am trying to run server for iphone using http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server

My machine is mac 10.6.8 Python versi

相关标签:
3条回答
  • 2021-01-04 09:06

    The problem is that an __init__.py file is not present under zope directory so this directory is not scanned for imports.

    Creating a blank __init__.py file under zope directory will do the trick.

    I solved this error in UNIX by browsing to the zope directory by executing:

    $touch __init__.py
    

    I can confirm that this works also with virtualenv pip installation of zope interface

    0 讨论(0)
  • 2021-01-04 09:16

    Here's a solution

    It says that installing a zope module through pip breaks your zope installation because pip installs it in another directory other than the original zope module directory.

    From the link

    After install a zope module using pip, for example z3c.password your zope installation gets broken.

    This is because pip have installed the module in /usr/local/lib/python2.6/dist-packages/zope and the original module zope.interface is in /usr/share/pyshared/zope/interface/ and has minor relevance when importing.

    What worked for me is (also given in the link):

    cd /usr/local/lib/python2.7/dist-packages/zope 
    sudo ln -s /usr/share/pyshared/zope/interface/
    
    0 讨论(0)
  • 2021-01-04 09:17

    Off the top of my head you can use easy_install for this.

    You will need the python-setuptools then you should be able to use

    easy_install zope.interface
    

    If I remember correctly however twisted should be installed as part of OS X python install. Do a quick Google for installing zope.interface for Mac OS X. As twisted is such a widely used library there is plenty of information out there.

    0 讨论(0)
提交回复
热议问题