Mac OS X 10.6 Python 2.7 pytidylib utidylib 找不到 libtidy
我正在回答我自己的问题,但因为我整夜都在思考这个问题,所以我希望能给其他人带来一些痛苦。如果您在正确安装 pytidylib 后收到以下消息之一,或者utidylib,这个答案可能会有所帮助。
在 Snow Leopard 上学习 Python 时,我安装了 32 位版本的 Python 2.7,以便可以使用 IDLE 解释器/编辑器。 Stackoverflow 有一个很棒的 解释为什么我必须这样做。
当我安装 utidylib 时,我从“import tidy
”中收到以下错误:
“OSError: 无法找到 libtidy,请确保已安装它
。”
使用 pytidylib,当我尝试 'from tidylib import tidy_document
' 时,出现此错误:
'OSError: 无法使用以下任何名称加载 libtidy:libtidy、libtidy.so、libtidy-0.99。 so.0,cygtidy-0-99-0,tidylib,libtidy.dylib,tidy.
'
如果您收到这些错误,请阅读此答案。我希望它对你有帮助。
I am answering my own question, but because I stayed up all night figuring it out, I will hopefully save others some pain. If you are getting either of the following messages after properly installing pytidylib or utidylib, this answer may help.
Learning Python on Snow Leopard, I had installed the 32-bit version of Python 2.7 so that I could use the IDLE interpreter/editor. Stackoverflow has a great explanation why I had to do this.
When I installed utidylib, I got the following error from 'import tidy
':
'OSError: Couldn't find libtidy, please make sure it is installed
.'
With pytidylib, I got this error when I tried 'from tidylib import tidy_document
':
'OSError: Could not load libtidy using any of these names: libtidy,libtidy.so,libtidy-0.99.so.0,cygtidy-0-99-0,tidylib,libtidy.dylib,tidy.
'
If you are getting these errors, please read this answer. I hope it helps you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在 Linux 上遇到了类似的问题(请参阅下面的堆栈跟踪)。
在 Ubuntu 11.10 (Python 2.7) 和 Gentoo (Python 2.6) 上的 virtualenv 中使用 pip 安装了 pytidylib==0.2.1。
在 Ubuntu 上安装 apt-get install libtidy-dev ,在 Gentoo 上安装 emerge app-text/htmltidy ,解决了这个问题。
I had a similar issue (see stacktrace below) on Linux.
With pytidylib==0.2.1 installed with pip in a virtualenv on both Ubuntu 11.10 (Python 2.7) and Gentoo (Python 2.6).
Installing
apt-get install libtidy-dev
on Ubuntu andemerge app-text/htmltidy
on Gentoo, solved it.虽然看起来 Python 包找不到这些文件,但真正发生的情况是我为错误的架构编译了 libtidy:x86_64 而不是 i386。使用 32 位 Python 安装程序使它们不兼容。
对于像我这样的新手,
lipo
会告诉您文件的架构:您可能需要找到 libtidy.dylib 和 python 文件进行比较。要解决此问题,您必须为 i386 重新编译 libtidy(或链接到系统上已有的 i386 编译的 libtidy)。要重新编译 i386,请使用这些说明以下修改:
这对我有用。我希望它也适合你。
Although it looked like the Python packages could not find the files, what was really happening was that I compiled libtidy for the wrong architecture: x86_64 instead of i386. Using the 32-bit Python installer made them incompatible.
For neophytes like me,
lipo
will tell you the architecture of your files:You may have to locate your libtidy.dylib and python files to compare. To fix the problem, you have to re-compile libtidy for i386 (or link to an i386-compiled libtidy already on your system). To re-compile for i386, use these instructions with the following modification:
This worked for me. I hope it also works for you.
我有同样的问题。我安装了 tidylib,但仍然出现如下错误。
然后我将 /usr/bin/tidy 复制到我的项目文件夹中,问题就解决了。
I had a same issue.I installed tidylib,but still come out error as followed.
then I copy /usr/bin/tidy to my project folder ,and it got solved.