简体   繁体   English

没有名为Alchemy API的模块

[英]No module named Alchemy API

I am trying to run Alchemy API on my computer for python 2.7. 我正在尝试在计算机上针对python 2.7运行Alchemy API。 This is the file: 这是文件:

AlchemyAPI.py-2.5

I have kept it in the same file as the Code: 我将其与代码保存在同一文件中:

# Load the AlchemyAPI module code.
import AlchemyAPI


# Create an AlchemyAPI object.
alchemyObj = AlchemyAPI.AlchemyAPI()


# Load the API key from disk.
alchemyObj.loadAPIKey("api_key.txt")


# Extract a ranked list of named entities from a web URL.
result = alchemyObj.URLGetRankedNamedEntities("http://www.techcrunch.com/");
print (result)


# Extract a ranked list of named entities from a text string.
result = alchemyObj.TextGetRankedNamedEntities("Hello my name is Bob.  I am speaking to you at this very moment.  Are you listening to me, Bob?");
print (result)


# Load a HTML document to analyze.
htmlFileHandle = open("data/example.html", 'r')
htmlFile = htmlFileHandle.read()
htmlFileHandle.close()


# Extract a ranked list of named entities from a HTML document.
result = alchemyObj.HTMLGetRankedNamedEntities(htmlFile, "http://www.test.com/");
print (result)

This is the standard code and gives the error i have mentioned in the heading. 这是标准代码,并给出了我在标题中提到的错误。 As required by README i have copied the AlchemyAPI.py-2.5 into the same directory. 根据自述文件的要求,我已将AlchemyAPI.py-2.5复制到同一目录中。 Im not sure how py-2.5 file works. 我不确定py-2.5文件如何工作。

you should remove the -2.5 from the file extension, just save it as "AlchemyAPI.py" 您应该从文件扩展名中删除-2.5,只需将其另存为“ AlchemyAPI.py”

Also, if you are running python 2.7, is there a reason you are using the python 2.5 version file? 另外,如果您运行的是python 2.7,是否有理由使用python 2.5版本文件?

Do you vizit that page ? 您浏览该页面吗? It contains all information about AlchemyAPI module. 它包含有关AlchemyAPI模块的所有信息。

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

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