为了使用Docker SDK for Python,我试图在Python脚本中导入docker,但是它导致了一个带有以下回溯的ImportError:
Traceback (most recent call last):
File "/home/kurt/dev/clones8/ipercron-compose/furion/iclib/tests/test_utils/docker_utils.py",line 1,in
奇怪的是导入确实在其他地方工作,例如在iPython提示符中:
Python 2.7.12 (default,Nov 19 2016,06:48:10)
Type "copyright","credits" or "license" for more information.
IPython 2.4.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object',use 'object??' for extra details.
In [1]: import docker
In [2]:
为什么导入在第一种情况下不起作用?
最佳答案