1.相关
1.1 实现的论文
Rethinking Knowledge Graph Propagation for Zero-Shot Learning, in CVPR 2019
1.2 运行环境要求
(1)python 3
(2)pytorch 0.4.0 conda install pytorch
(3)nltk conda install nltk
1.2.1 from glove import GloVe报错
文件目录的因素
1.2.2
Traceback (most recent call last):
File "C:/Users/xpb/PycharmProjects/DGP-master/materials/make_induced_graph.py", line 4, in <module>
from nltk.corpus import wordnet as wn
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\__init__.py", line 150, in <module>
from nltk.translate import *
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\translate\__init__.py", line 23, in <module>
from nltk.translate.meteor_score import meteor_score as meteor
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\translate\meteor_score.py", line 10, in <module>
from nltk.stem.porter import PorterStemmer
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\stem\__init__.py", line 29, in <module>
from nltk.stem.snowball import SnowballStemmer
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\stem\snowball.py", line 32, in <module>
from nltk.corpus import stopwords
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\__init__.py", line 66, in <module>
from nltk.corpus.reader import *
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\reader\__init__.py", line 105, in <module>
from nltk.corpus.reader.panlex_lite import *
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\reader\panlex_lite.py", line 15, in <module>
import sqlite3
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed: 找不到指定的模块。
解决方法:把其他环境的sqlite3.dll文件复制到C:\Users\xpb\Anaconda3\envs\Python36\DLLs目录下
或到官网下载[https://sqlite.org/download.html](https://sqlite.org/download.html)找准那个 Precompiled Binaries for Windows 那一项就是的了。
1.2.5
Traceback (most recent call last):
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\util.py", line 86, in __load
root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\data.py", line 701, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource wordnet not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('wordnet')
For more information see: https://www.nltk.org/data.html
Attempted to load corpora/wordnet.zip/wordnet/
Searched in:
- 'C:\\Users\\xpb/nltk_data'
- 'C:\\Users\\xpb\\Anaconda3\\envs\\Python36\\nltk_data'
- 'C:\\Users\\xpb\\Anaconda3\\envs\\Python36\\share\\nltk_data'
- 'C:\\Users\\xpb\\Anaconda3\\envs\\Python36\\lib\\nltk_data'
- 'C:\\Users\\xpb\\AppData\\Roaming\\nltk_data'
- 'C:\\nltk_data'
- 'D:\\nltk_data'
- 'E:\\nltk_data'
**********************************************************************
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/xpb/PycharmProjects/DGP-master/materials/make_induced_graph.py", line 54, in <module>
xml_nodes = list(map(getnode, xml_wnids))
File "C:/Users/xpb/PycharmProjects/DGP-master/materials/make_induced_graph.py", line 11, in getnode
return wn.synset_from_pos_and_offset('n', int(x[1:]))
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\util.py", line 123, in __getattr__
self.__load()
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\util.py", line 88, in __load
raise e
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\corpus\util.py", line 83, in __load
root = nltk.data.find('{}/{}'.format(self.subdir, self.__name))
File "C:\Users\xpb\Anaconda3\envs\Python36\lib\site-packages\nltk\data.py", line 701, in find
raise LookupError(resource_not_found)
解决方法: 在python命令窗口输入以下语句:
import nltk
nltk.download()
跳出窗口之后,选择要下载的包
2.
参考资料
[1] from _sqlite3 import * ,debug出错信息: ImportError: DLL load failed: 找不到指定的模块。
[2] 【出错笔记】Anaconda Sqlite3 ImportError: DLL load failed 问题解决
[3] LookupError: Resource averaged_perceptron_tagger not found. Please use the NLTK Downloader to obtain the resource:
[4] Python3下的NLTK及nltk_data安装问题(Ubuntu环境)