Top "Python-import" questions

For questions about importing modules in Python

python packaging for relative imports

First off all: I'm sorry, I know there has been lots of question about relative imports, but I just didn't …

python python-import
ImportError: No module named 'cv2' Python3

I have such a problem (face_det) user@pc:~$ python3 Python 3.5.3 (default, Apr 22 2017, 00:00:00) [GCC 4.8.4] on linux Type "help", "copyright", "credits" …

python python-3.x opencv python-import cv2
Dynamic loading of python modules

In python how do you dynamically add modules to a package while your program is running. I want to be …

python dynamic python-import
ImportError: No Module named xlwt

My sytem: Windows, Python 2.7 I downloaded a package and want to include it in my script. After I unzipped the …

python importerror python-import
How to unimport a python module which is already imported?

I'm quite new with NumPy/SciPy. But these days, I've started using it very actively for numerical calculation instead of …

python python-import
Attempted relative import with no known parent package

from ..box_utils import decode, nms This line is giving error ImportError: attempted relative import with no known parent package …

python-3.x python-import importerror
What's the correct way to sort Python `import x` and `from x import y` statements?

The python style guide suggests to group imports like this: Imports should be grouped in the following order: standard library …

python coding-style python-import pep8
how to "reimport" module to python then code be changed after import

I have a foo.py def foo(): print "test" In IPython I use: In [6]: import foo In [7]: foo.foo() test …

python runtime ipython overloading python-import
How to mock an import

Module A includes import B at its top. However under test conditions I'd like to mock B in A (mock …

python mocking python-import
'Attempted relative import in non-package' although packages with __init__.py in one directory

I have a module named extended.py which contains the following line: from .basic import BasicModule and the file basic.…

python python-2.7 python-import