vendredi 14 novembre 2014

python - Django, apache et nltk importer erreur - Stack Overflow


I am using Django 1.5.3, Python 2.7.3 and Apache 2.2 with mod_wsgi on Windows and i have the following Nltk loading problem:


File "C:\\Users\\Christos\\workspace\\djangolesson\\question_handling.py", line 11, in  
<module> stop_words = corpus.stopwords.words('english')
File "C:\\Python27\\lib\\site-packages\\nltk\\corpus\\util.py", line 68, in __getattr__
self.__load()
File "C:\\Python27\\lib\\site-packages\\nltk\\corpus\\util.py", line 56, in __load
except LookupError: raise e
LookupError:
**********************************************************************
Resource 'corpora/stopwords' not found. Please use the NLTK
Downloader to obtain the resource: >>> nltk.download()
Searched in:
- 'C:\\\\Windows\\\\system32\\\\config\\\\systemprofile/nltk_data'
- 'C:\\\\nltk_data'
- 'D:\\\\nltk_data'
- 'E:\\\\nltk_data'
- 'C:\\\\Python27\\\\nltk_data'
- 'C:\\\\Python27\\\\lib\\\\nltk_data'
- 'C:\\\\Windows\\\\system32\\\\config\\\\systemprofile\\\\AppData\\\\Roaming\\\\nltk_data'
**********************************************************************

from apaches' error.log, for any nltk module, while loading it from a shell, or even running the same .py file doesn't raise any problems and it works fine. Others have had the same problem, but i couldn't find a solution. Thanks in advance

#

Thanks to @codeape i have found a solution: I reinstalled nltk in C:\Python27\nltk_data and it works.



I am using Django 1.5.3, Python 2.7.3 and Apache 2.2 with mod_wsgi on Windows and i have the following Nltk loading problem:


File "C:\\Users\\Christos\\workspace\\djangolesson\\question_handling.py", line 11, in  
<module> stop_words = corpus.stopwords.words('english')
File "C:\\Python27\\lib\\site-packages\\nltk\\corpus\\util.py", line 68, in __getattr__
self.__load()
File "C:\\Python27\\lib\\site-packages\\nltk\\corpus\\util.py", line 56, in __load
except LookupError: raise e
LookupError:
**********************************************************************
Resource 'corpora/stopwords' not found. Please use the NLTK
Downloader to obtain the resource: >>> nltk.download()
Searched in:
- 'C:\\\\Windows\\\\system32\\\\config\\\\systemprofile/nltk_data'
- 'C:\\\\nltk_data'
- 'D:\\\\nltk_data'
- 'E:\\\\nltk_data'
- 'C:\\\\Python27\\\\nltk_data'
- 'C:\\\\Python27\\\\lib\\\\nltk_data'
- 'C:\\\\Windows\\\\system32\\\\config\\\\systemprofile\\\\AppData\\\\Roaming\\\\nltk_data'
**********************************************************************

from apaches' error.log, for any nltk module, while loading it from a shell, or even running the same .py file doesn't raise any problems and it works fine. Others have had the same problem, but i couldn't find a solution. Thanks in advance

#

Thanks to @codeape i have found a solution: I reinstalled nltk in C:\Python27\nltk_data and it works.


0 commentaires:

Enregistrer un commentaire