我正在尝试this open-source library from GitHub called talon从一个与工作相关的项目的电子邮件签名中提取重要信息,但似乎遇到了“nota Directory”错误。我已经很久没有使用Python了,所以请你容忍我。
这是我要运行的使用talon模块的示例脚本,称为test.py
:
import talon
from talon import quotations
talon.init()
text = """Reply
-----Original Message-----
Quote"""
reply = quotations.extract_from(text, 'text/plain')
reply = quotations.extract_from_plain(text)
在使用python2.7.11到python test.py
运行此程序时,我得到以下错误输出:
我做了同样的事情,但是使用的是Python 3.7.1,我得到了一个类似的错误:
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/scikit_learn-0.20.0-py3.7-macosx-10.9-x86_64.egg/sklearn/externals/joblib/externals/cloudpickle/cloudpickle.py:47: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/learning/classifier.py", line 34, in load
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/scikit_learn-0.20.0-py3.7-macosx-10.9-x86_64.egg/sklearn/externals/joblib/numpy_pickle.py", line 590, in load
with open(filename, 'rb') as f:
NotADirectoryError: [Errno 20] Not a directory: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/data/classifier'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 4, in <module>
talon.init()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/__init__.py", line 13, in init
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/__init__.py", line 39, in initialize
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/learning/classifier.py", line 38, in load
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/learning/classifier.py", line 50, in load_compat
NotADirectoryError: [Errno 20] Not a directory: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/talon-1.4.5-py3.7.egg/talon/signature/data'
有没有人和我经历过同样的问题?否则,我该怎么办?在
我想我主要是在包含我下载的talon repo的目录中使用sudo python setup.py install
来安装它,因为我的工作帐户不允许我在没有根级访问权限的情况下单独安装Python库。在
编辑:有人向我指出pip install talon
。在
这是使用--user
选项运行上述命令时得到的输出:
Requirement already satisfied (use --upgrade to upgrade): talon in /usr/local/lib/python2.7/site-packages/talon-1.4.5-py2.7.egg
Requirement already satisfied (use --upgrade to upgrade): lxml>=2.3.3 in /usr/local/lib/python2.7/site-packages/lxml-4.2.5-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): regex>=1 in /usr/local/lib/python2.7/site-packages/regex-2018.8.29-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7/site-packages (from talon)
Requirement already satisfied (use --upgrade to upgrade): scipy in /usr/local/lib/python2.7/site-packages (from talon)
Requirement already satisfied (use --upgrade to upgrade): scikit-learn>=0.16.1 in /usr/local/lib/python2.7/site-packages/scikit_learn-0.20.0-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): chardet>=1.0.1 in /usr/local/lib/python2.7/site-packages/chardet-3.0.4-py2.7.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): cchardet>=0.3.5 in /usr/local/lib/python2.7/site-packages/cchardet-2.1.4-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): cssselect in /usr/local/lib/python2.7/site-packages/cssselect-1.0.3-py2.7.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): six>=1.10.0 in /Library/Python/2.7/site-packages (from talon)
Requirement already satisfied (use --upgrade to upgrade): html5lib in /usr/local/lib/python2.7/site-packages/html5lib-1.0.1-py2.7.egg (from talon)
Requirement already satisfied (use --upgrade to upgrade): webencodings in /usr/local/lib/python2.7/site-packages/webencodings-0.5.1-py2.7.egg (from html5lib->talon)
You are using pip version 8.1.2, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
这是使用--upgrade
标志时的输出:
Requirement already up-to-date: talon in /usr/local/lib/python2.7/site-packages/talon-1.4.5-py2.7.egg
Requirement already up-to-date: lxml>=2.3.3 in /usr/local/lib/python2.7/site-packages/lxml-4.2.5-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already up-to-date: regex>=1 in /usr/local/lib/python2.7/site-packages/regex-2018.8.29-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already up-to-date: numpy in /usr/local/lib/python2.7/site-packages (from talon)
Requirement already up-to-date: scipy in /usr/local/lib/python2.7/site-packages (from talon)
Requirement already up-to-date: scikit-learn>=0.16.1 in /usr/local/lib/python2.7/site-packages/scikit_learn-0.20.0-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already up-to-date: chardet>=1.0.1 in /usr/local/lib/python2.7/site-packages/chardet-3.0.4-py2.7.egg (from talon)
Requirement already up-to-date: cchardet>=0.3.5 in /usr/local/lib/python2.7/site-packages/cchardet-2.1.4-py2.7-macosx-10.11-x86_64.egg (from talon)
Requirement already up-to-date: cssselect in /usr/local/lib/python2.7/site-packages/cssselect-1.0.3-py2.7.egg (from talon)
Collecting six>=1.10.0 (from talon)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Requirement already up-to-date: html5lib in /usr/local/lib/python2.7/site-packages/html5lib-1.0.1-py2.7.egg (from talon)
Requirement already up-to-date: webencodings in /usr/local/lib/python2.7/site-packages/webencodings-0.5.1-py2.7.egg (from html5lib->talon)
Installing collected packages: six
Successfully installed six-1.10.0
不幸的是,这对上述问题没有任何影响。
目前没有回答
相关问题 更多 >
编程相关推荐