无法从 python 脚本导入 libxml2mod

发布于 2024-08-02 18:36:41 字数 401 浏览 1 评论 0原文

File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in <module>
  import libxml2mod

    ImportError: /usr/local/lib/python2.5/site-packages/libxml2mod.so: 
    undefined symbol:xmlTextReaderSetup

>>> import libxml2mod
>>> import libxml2
>>>

在 Python 提示下它工作正常!

任何人都可以知道为什么我的程序无法从 .py 文件运行,因为导入在 python 提示符下运行得很好。

File "/usr/local/lib/python2.5/site-packages/libxml2.py", line 1, in <module>
  import libxml2mod

    ImportError: /usr/local/lib/python2.5/site-packages/libxml2mod.so: 
    undefined symbol:xmlTextReaderSetup

>>> import libxml2mod
>>> import libxml2
>>>

on Python Prompt it works fine !!

can anyone has idea why my program is not working from .py file as import is working perfect from python prompt.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

穿透光 2024-08-09 18:36:41

我只能建议你们的道路由于某种原因而不同。要么是这样,要么在这两种情况下您没有使用相同的 python 解释器。

当我碰巧有几个解释器时,我就经历过这种情况,错误的解释器要么是默认的,要么是在 #! 中指定的。脚本部分。

I can only suggest that your paths are different for some reason. Either that, or you are not using the same python interpreter in both cases.

I have experienced this when I happen to have a couple of interpreters, and the wrong one is either default, or specified in the #! section of the script.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文