在PyCharm上导入NLTK时出错

在PyCharm上导入NLTK时出错

本文介绍了在PyCharm上导入NLTK时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在PyCharm中导入NLTK,并收到以下错误.我在使用Python 2.7.6的Mac OS 10.5.8上.可能是怎么回事?我是编程的新手,如果我缺少一些基本知识,那么请抱歉.

I'm trying to import NLTK in PyCharm, and get the following error. I'm on Mac OS 10.5.8 with Python 2.7.6. What could be going on? I'm completely new to programming, so sorry if there's something basic that I'm missing.

安装软件包失败:安装软件包nltk时发生错误.

Install packages failed: Error occurred when installing package nltk.

已执行以下命令:

命令的错误输出:

Downloading/unpacking nltk
Could not fetch URL https://pypi.python.org/simple/nltk/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/nltk/ when looking for download links for nltk
Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/ when looking for download links for nltk
Cannot fetch index base URL https://pypi.python.org/simple/
Could not fetch URL https://pypi.python.org/simple/nltk/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed>
Will skip URL https://pypi.python.org/simple/nltk/ when looking for download links for nltk
Could not find any downloads that satisfy the requirement nltk
Cleaning up...
No distributions at all found for nltk
Storing complete log in /Users/Tom/.pip/pip.log

ETA:好的,现在我已经从命令行成功安装了NLTK,然后能够将其安装在PyCharm中-但仅适用于Python 2.5.1解释器.如果我使用Python 2.7.6进行尝试,仍然会出现上述错误.这很重要,还是我不必担心,仅将其与2.5.1一起使用?

ETA: OK, now I've successfully installed NLTK from the command line, and then was able to install it in PyCharm -- but only for the Python 2.5.1 interpreter. If I try it with Python 2.7.6, I still get the error above. Does this matter, or should I not worry about it and just use it with 2.5.1?

推荐答案

您最好坚持使用最新版本的pip(1.5.6),并告诉您您不关心以下内容的安全性:您的python包:

You'd be much better off sticking with the latest version of pip (1.5.6) and just telling it that you don't care about the security of your python packages:

pip install --allow-all-external --allow-unverified ntlk nltk

如果您真的想确保安装程序不会受到任何投诉,也可以告诉它不要覆盖任何现有安装程序:

If you really want to be sure an install runs without complaint, you can also tell it not to overwrite any existing installations:

pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk

pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk

如果出现文件写入权限错误,则为sudo.

And sudo if you get file write permission errors.

这篇关于在PyCharm上导入NLTK时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 17:47