简体   繁体   English

在Python中安装RAKE时出现命名空间包错误

[英]Namespace package error when installing RAKE in Python

When I am trying to install RAKE - Rapid Automatic Keywords Extraction I am getting the following error on both Windows 8 and Ubuntu 14.04 with Python 2.7: 当我尝试安装RAKE-快速自动关键字提取时,在Windows 8和带有Python 2.7的Ubuntu 14.04上都出现以下错误:

error: Namespace package problem: rake is a namespace package, but its
`__init__.py` does not call declare_namespace()! Please fix it.
(See the setuptools manual under "Namespace Packages" for details.)

I have tried installation using pip as well as manual installation with python install setup.py . 我已经尝试使用pip安装,以及使用python install setup.py手动安装。

What does this error mean and how do I fix it? 此错误是什么意思,我该如何解决?

I had the above error when trying to install rake with pip install rake . 尝试使用pip install rake安装rake时出现上述错误。 Searching for the proper package name with pip search rake gave a list including python-rake . 使用pip search rake搜索正确的软件包名称会给出一个列表,其中包括python-rake Running the line pip install python-rake fixed the error / properly installed rake. 运行行pip install python-rake修复了错误/正确安装了rake。

Note the import of rake uses all caps (ie, import RAKE ), as shown in the project's repo . 请注意,如项目的repo所示,rake的导入使用所有大写字母(即import RAKE )。

Actually the module is under RAKE as RAKE. 实际上,该模块在RAKE下为RAKE。 I tried the following and it worked. 我尝试了以下方法,它奏效了。

    import RAKE.RAKE as rake

    rake.Rake("path/to/stop/list")
    ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM