2017-01-25 5 views
1

(Mac OS X 10.12.2)question d'installer le modèle anglais dans Spacy pour python3

Alors, quand je lance ces 2 lignes:

pip install spacy 
python -m spacy.en.download all 

il fonctionne parfaitement et je peux utiliser avec l'anglais spacy modèle en python (2.x)

mais quand je lance la même chose pour python3 (3.6.0)

pip3 install spacy 
python3 -m spacy.en.download all 

installe Spacy mais j'ai eu des erreurs lors du téléchargement du modèle. Alors, quand je l'utilise ensuite dans spacy python3 cela ne fonctionne pas, je suis arrivé à la place des champs vides de pos, étiquette ...

les erreurs que je reçois sont liés à qu'urllib:

Downloading parsing model 
Traceback (most recent call last): 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open 
encode_chunked=req.has_header('Transfer-encoding')) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request 
self._send_request(method, url, body, headers, encode_chunked) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request 
self.endheaders(body, encode_chunked=encode_chunked) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders 
self._send_output(message_body, encode_chunked=encode_chunked) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output 
self.send(msg) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send 
self.connect() 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1400, in connect 
server_hostname=server_hostname) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket 
_context=self, _session=session) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__ 
self.do_handshake() 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake 
self._sslobj.do_handshake() 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake 
self._sslobj.do_handshake() 
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main 
"__main__", mod_spec) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code 
exec(code, run_globals) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/en/download.py", line 25, in <module> 
plac.call(main) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/plac_core.py", line 328, in call 
cmd, result = parser.consume(arglist) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/plac_core.py", line 207, in consume 
return cmd, self.func(*(args + varargs + extraopts), **kwargs) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/en/download.py", line 18, in main 
download('en', force=False, data_path=data_path) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/download.py", line 36, in download 
about.__models__.get(lang, lang), data_path) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sputnik/__init__.py", line 37, in install 
index.update() 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sputnik/index.py", line 84, in update 
index = json.load(session.open(request, 'utf8')) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sputnik/session.py", line 43, in open 
r = self.opener.open(request) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open 
response = self._open(req, data) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open 
'_open', req) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain 
result = func(*args) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open 
context=self._context, check_hostname=self._check_hostname) 
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open 
raise URLError(err) 
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)> 

Toutes les idées sur Que faire?

merci beaucoup! acclamations

EDIT: J'ai posé la question sur le dépôt spacy sur Github aussi bien et apparemment le seul moyen est de copier/coller les données de python2.7 à python3.6:

donc je ve copier/coller le dossier en-1.1.0 de /Users/[myname]/anaconda/lib/python2.7/site-packages/spacy/data à /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spacy/data/

et tout fonctionne très bien, peut utiliser Spacy dans python3 maintenant!

espère que cela aidera les autres

Répondre

0

Depuis que je suis nouveau Stackoverflow Je ne suis pas en mesure de commenter ou marquer cette question comme un doublon possible ...
donc comme une réponse « normale »: Comme mentionné dans this répondre, il semble qu'il existe une solution pour Mac OS. J'espère que cela t'aides!