[PYTHON] ImportError: No module What to do when you are told

python


import pyramid.config

Then, ʻImportError: No module named interface came to be said. ʻEasy_install zope.interface doesn't help, so I investigated the cause.

python


In [1]: import zope.interface
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-bc61dfc4e3ea> in <module>()
----> 1 import zope.interface

ImportError: No module named interface

path confirmation

ipython


In [1]: import sys
In [2]: sys.path
Out[2]: 
['',
 '/usr/bin',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/IPython/extensions']

Find a storage location for the zope package

python


$ locate zope | more
...
/usr/local/lib/python2.7/dist-packages/zope
...
/usr/lib/python2.7/dist-packages/zope.interface-4.0.5.egg-info
...
/usr/share/pyshared/zope.interface-4.0.5.egg-info
...

python


$ ls /usr/local/lib/python2.7/dist-packages/zope
deprecation

Removed because this package is in the way.

python


$ sudo rm -r /usr/local/lib/python2.7/dist-packages/zope*

python


$ sudo easy_install zope.interface
$ sudo easy_install zope.deprecation

python


import pyramid.config

Succeeded.

python


import zope.interface
help(zope.interface)
...
FILE
    /usr/lib/python2.7/dist-packages/zope/interface/__init__.py

Recommended Posts

ImportError: No module What to do when you are told
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do when you can't bind CaboCha to Python
What to do when Ubuntu crashes
[AWS] What to do when you want to pip with Lambda
What to do if you are addicted to Windows character code
What to do if you are told "Import Error: cannot import name'HTTPSHandler'" when building a virtual environment using virtualenv
What to do if you get Swagger-codegen in python and Import Error: No module named
What to do when the jupyterlab extension settings are not reflected
What to do when you get "I can't see the site !!!!"
Let's summarize what you want to do.
What to do if you install openCV3 and make a symbolic link, but when you do "import cv2", "No module named'cv2'" appears
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
What to do if you can't pipenv shell
What to do when PermissionError of tempfile.mkstemp occurs
What are you using when testing with Python?
What to do if you get a "No versions found" error in pipenv
What to do if you get an error when installing python with pyenv
What to do when [Errno 2] No such file or directory appears in Python
What to do when you want to receive files from a Windows client remotely
[Go 1.13] What to do when unexpected directory layout: appears
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
curl: (60) What to do when Issuer certificate is invalid.
What to do when gdal_merge creates a huge file
What to do when raise ValueError, "unsupported hash type"
Links to do what you want with Sublime Text
What to do when "cannot import name xxx" [Python]
Things to do when you start developing with Django
pipenv shell is no longer available ... what to do?
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if you don't want to use Japanese column names when using ortoolpy.logistics_network
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do when Japanese is not displayed on matplotlib
What to do when PyCharm font is strange or garbled
What to do when a Remove Error occurs when updating conda
What to do when there is no response due to Proxy setting in Python web scraping
What to do when Unalignable boolean Series provided as indexer
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do when an error occurs with import _ssl
What to do if package installation fails when deploying to heroku
What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
OSError: [Errno 40] What to do when Message too long appears
What to do when "Invalid HTTP_HOST header" appears in Django
What to do if you can't log in as root
What to do if Linux VLC can no longer rotate
What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS
What to do if you lose your EC2 key pair
What to do if you get an error when running "certbot renew" in CakePHP environment
What to do when no display name occurs when unittesting Python + Tkinter on Github Actions Memo
If you can't use Beautiful Soup 4 after updating to Python 3.5. ImportError: No module named bs4
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if you get a must override `get_config` error when trying to model.save in Keras
What to do if you get angry if you don't have libxml / xmlversion.h when installing lxml on CentOS
[AWS] What to do when the ping command causes a "timeout"
What to do if you can't install pyaudio with pip #Python