5

我在 Mac 上使用sudo easy_install python-jenkins. 安装很顺利,没有错误,但是当我打开python并输入时,import jenkins出现以下错误。

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.macosx-10.7-intel/egg/jenkins.py", line 9, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Library/Python/2.7/site-packages/lookup3.so, 6): image not found

谷歌搜索这并没有产生任何有用的结果。

编辑后的追溯

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "jenkins.py", line 9, in <module>
    lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.dynlib"))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Library/Python/2.7/site-packages/lookup3.dynlib, 6): image not found
4

4 回答 4

3

有问题的模块与 Mac OS X 动态库约定不兼容。

它会尝试加载lookup3.so文件,但在 Mac 上它会lookup3.dynlib改为加载文件。您可以通过查看/Library/Python/2.7/site-packages目录来验证这一点。然后只需编辑jenkins.py模块并将.so扩展名替换为.dynlib.

我也会将此报告给模块的问题跟踪器;一个简单的if platform.system() == 'Darwin':开关将使事物可以跨平台加载。

更新:实际上,模块固执地希望lookup3.so模块位于site-packages目录中,而不是模块本身。因此它与 easy_install 不兼容。当您将所有文件(未更改)从.egg目录中直接移到您的/Library/Python/2.7/site-packages/目录中时,它将起作用。

于 2012-08-31T10:53:39.420 回答
3

OSError:dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/lookup3.so,6):找不到图像

从目录中 /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages,,

ln -s lookup3.cpython-36m-darwin.so lookup3.so

为我工作。

于 2019-12-09T23:15:08.987 回答
1

我发现lookup.so jenkins.py 正在尝试加载:

/Users/MY-USER/Documents/Telnyx/dev/tdm-get-ips/venv/lib/python3.7/site-packages/lookup3.cpython-37m-darwin.so

所以我改变了

python3.7/site-packages/jenkins.py

线:

lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.so"))

为了:

lookup3 = cdll.LoadLibrary(os.path.join(get_python_lib(), "lookup3.cpython-37m-darwin.so"))

它开始正常工作。

于 2020-07-31T09:41:02.763 回答
0

你可以试试:

pip uninstall jenkins

pip install python-jenkins

为我工作。

于 2021-08-30T06:06:04.277 回答