gpt4 book ai didi

python - Textract - 属性错误 : 'module' object has no attribute 'process' - pointing to non existent file

转载 作者:行者123 更新时间:2023-12-05 07:26:46 26 4
gpt4 key购买 nike

我正在尝试对从 .doc、.docx 和 .pdf 文件中获取文本的各种方式进行一些速度测试,并遇到了用于 Python 的 textract,这看起来很有希望。我已经安装了 textract 及其在 Kali Linux (Debian) 上的所有依赖项,我只是想运行一个简单的测试:

import os
import sys
import textract

text = textract.process("/home/owain/Documents/Documents/file.doc")

我将文件命名为 textract.py 然后我发现它有问题:Converting .doc to pure text using Python

我得到的错误

kali@Kali:~/Scripts/TestScripts$ time python tttt.py
Traceback (most recent call last):
File "tttt.py", line 3, in <module>
import textract
File "/home/owain/Scripts/TestScripts/textract.py", line 4, in <module>
AttributeError: 'module' object has no attribute 'process'

所以我删除了 textract,删除了 textract.py 文件并重新安装了 textract。这没有用,因为我仍然遇到上述相同的错误,即使该文件不再存在也是如此。不确定从这里去哪里,所以任何帮助将不胜感激!

最佳答案

发生这种情况是因为您有一个名为 textract 的文件,它与实际的依赖项名称冲突。

关于python - Textract - 属性错误 : 'module' object has no attribute 'process' - pointing to non existent file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54283514/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com