安装gensim出现的错误

令人蛋疼的gensim安装
小编最近做毕业设计涉及到NLP自然语言处理领域,在使用python的时候需要下载一个gensim模块,但是在进行pip install gensim的时候出现了很多错误。如下

import gensim
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\Arock\Anaconda2\lib\site-packages\gensim_init_.py”, line 5, in
from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
File “C:\Users\Arock\Anaconda2\lib\site-packages\gensim\parsing_init_.py”, line 4, in
from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401
File “C:\Users\Arock\Anaconda2\lib\site-packages\gensim\parsing\preprocessing.py”, line 42, in
from gensim import utils
File “C:\Users\Arock\Anaconda2\lib\site-packages\gensim\utils.py”, line 45, in
from smart_open import smart_open
File “C:\Users\Arock\Anaconda2\lib\site-packages\smart_open_init_.py”, line 1, in
from .smart_open_lib import *
File “C:\Users\Arock\Anaconda2\lib\site-packages\smart_open\smart_open_lib.py”, line 30, in
import requests
File “C:\Users\Arock\Anaconda2\lib\site-packages\requests_init_.py”, line 52, in
from .packages.urllib3.contrib import pyopenssl
File “C:\Users\Arock\Anaconda2\lib\site-packages\requests\packages\urllib3\contrib\pyopenssl.py”, line 47, in
from cryptography import x509
File “C:\Users\Arock\Anaconda2\lib\site-packages\cryptography\x509_init_.py”, line 7, in
from cryptography.x509.base import (
File “C:\Users\Arock\Anaconda2\lib\site-packages\cryptography\x509\base.py”, line 16, in
from cryptography.x509.extensions import Extension, ExtensionType
File “C:\Users\Arock\Anaconda2\lib\site-packages\cryptography\x509\extensions.py”, line 14, in
from asn1crypto.keys import PublicKeyInfo
File “C:\Users\Arock\Anaconda2\lib\site-packages\asn1crypto\keys.py”, line 22, in
from ._elliptic_curve import (
File “C:\Users\Arock\Anaconda2\lib\site-packages\asn1crypto_elliptic_curve.py”, line 51, in
from ._int import inverse_mod
File “C:\Users\Arock\Anaconda2\lib\site-packages\asn1crypto_int.py”, line 56, in
from ._perf._big_num_ctypes import libcrypto
File “C:\Users\Arock\Anaconda2\lib\site-packages\asn1crypto_perf_big_num_ctypes.py”, line 31, in
libcrypto_path = find_library(‘crypto’)
File “C:\Users\Arock\Anaconda2\lib\ctypes\util.py”, line 53, in find_library
fname = os.path.join(directory, name)
File “C:\Users\Arock\Anaconda2\lib\ntpath.py”, line 88, in join
result_path = result_path + p_path
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xc8 in position 1: ordinal not in range(128)

这是魔鬼嘛???
查询了好多资料并没有很好的解决办法。都是让我换版本。
后来发现了编码错误!!!
ntpath.py文件修改
import sys
reload(sys)
sys.setdefaultencoding(“GBK”)
在lib文件夹下加上如上三条语句

执行之后
在这里插入图成了片描述最终成功了
小编这个菜鸟终于解决了这个问题。
开心的像一只300斤的胖子。

你可能感兴趣的:(安装gensim出现的错误)