win10 64位安装genism

1.因为电脑上装了easyinstall,网上搜了安装方法:easy_install -U gensim,可是好几次都报同样的错,猜是被墙了

C:\Users\dell>easy_install -U gensim

Searching for gensim
Reading https://pypi.python.org/simple/gensim/

error: ('The read operation timed out',)

2.于是开lantern,报的错不一样了

C:\Users\dell>easy_install -U gensim

Searching for gensim
Reading https://pypi.python.org/simple/gensim/
Best match: gensim 0.13.1
Processing gensim-0.13.1-py2.7-win-amd64.egg
gensim 0.13.1 is already the active version in easy-install.pth


Using c:\python27\lib\site-packages\gensim-0.13.1-py2.7-win-amd64.egg
Processing dependencies for gensim
Searching for six>=1.5.0
Reading https://pypi.python.org/simple/six/
Best match: six 1.10.0
Downloading https://pypi.python.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55
Processing six-1.10.0.tar.gz
Writing c:\users\dell\appdata\local\temp\easy_install-rqo2fm\six-1.10.0\setup.cfg
Running six-1.10.0\setup.py -q bdist_egg --dist-dir c:\users\dell\appdata\local\temp\easy_install-rqo2fm\six-1.10.0\egg-dist-tmp-2ajgl0
no previously-included directories found matching 'documentation\_build'
zip_safe flag not set; analyzing archive contents...
six: module references __path__
creating c:\python27\lib\site-packages\six-1.10.0-py2.7.egg
Extracting six-1.10.0-py2.7.egg to c:\python27\lib\site-packages
Adding six 1.10.0 to easy-install.pth file


Installed c:\python27\lib\site-packages\six-1.10.0-py2.7.egg
Searching for scipy>=0.7.0
Reading https://pypi.python.org/simple/scipy/
Best match: scipy 0.18.0
Downloading https://pypi.python.org/packages/5e/a3/d7241ac3921157e1f17569ad0591ed1966cacd3dc97c8abcf5807049e244/scipy-0.18.0.zip#md5=9ec1363dde2f2c16e833d3cd09f0dd13
Processing scipy-0.18.0.zip
Writing c:\users\dell\appdata\local\temp\easy_install-2nrpbn\scipy-0.18.0\setup.cfg
Running scipy-0.18.0\setup.py -q bdist_egg --dist-dir c:\users\dell\appdata\local\temp\easy_install-2nrpbn\scipy-0.18.0\egg-dist-tmp-xjni1c
c:\users\dell\appdata\local\temp\easy_install-2nrpbn\scipy-0.18.0\setup.py:322: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
Traceback (most recent call last):
  File "C:\Python27\Scripts\easy_install-script.py", line 9, in <module>
    load_entry_point('setuptools==24.0.2', 'console_scripts', 'easy_install')()
  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 2291, in main


  File "C:\Python27\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 409, in run


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 664, in easy_install


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 699, in install_item


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 741, in process_distribution


  File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 826, in resolve
  File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 1092, in best_match
  File "build\bdist.win-amd64\egg\pkg_resources\__init__.py", line 1104, in obtain
  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 664, in easy_install


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 694, in install_item


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 875, in install_eggs


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1114, in build_and_install


  File "build\bdist.win-amd64\egg\setuptools\command\easy_install.py", line 1100, in run_setup


  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 246, in run_setup
  File "C:\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 195, in setup_context
  File "C:\Python27\lib\contextlib.py", line 35, in __exit__
    self.gen.throw(type, value, traceback)
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 166, in save_modules
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 141, in resume
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 154, in save_modules
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 195, in setup_context
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 243, in run_setup
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 273, in run
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 242, in runner
  File "build\bdist.win-amd64\egg\setuptools\sandbox.py", line 46, in _execfile
  File "c:\users\dell\appdata\local\temp\easy_install-2nrpbn\scipy-0.18.0\setup.py", line 415, in <module>
  File "c:\users\dell\appdata\local\temp\easy_install-2nrpbn\scipy-0.18.0\setup.py", line 395, in setup_package

ImportError: No module named numpy.distutils.core

3.安装numpy

C:\Users\dell>easy_install numpy
Searching for numpy
Reading https://pypi.python.org/simple/numpy/
Best match: numpy 1.11.1
Downloading https://pypi.python.org/packages/e0/4c/515d7c4ac424ff38cc919f7099bf293dd064ba9a600e1e3835b3edefdb18/numpy-1.11.1.tar.gz#md5=2f44a895a8104ffac140c3a70edbd450
Processing numpy-1.11.1.tar.gz
Writing c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\setup.cfg
Running numpy-1.11.1\setup.py -q bdist_egg --dist-dir c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\egg-dist-tmp-y7nmae
Running from numpy source directory.
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\setup.py:327: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command, proceeding with "
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1646: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1655: UserWarning:
    Blas (http://www.netlib.org/blas/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [blas]) or by setting
    the BLAS environment variable.
  warnings.warn(BlasNotFoundError.__doc__)
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1658: UserWarning:
    Blas (http://www.netlib.org/blas/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [blas_src]) or by setting
    the BLAS_SRC environment variable.
  warnings.warn(BlasSrcNotFoundError.__doc__)
non-existing path in 'numpy\\distutils': 'site.cfg'
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1548: UserWarning:
    Atlas (http://math-atlas.sourceforge.net/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [atlas]) or by setting
    the ATLAS environment variable.
  warnings.warn(AtlasNotFoundError.__doc__)
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1559: UserWarning:
    Lapack (http://www.netlib.org/lapack/) libraries not found.
    Directories to search for the libraries can be specified in the
    numpy/distutils/site.cfg file (section [lapack]) or by setting
    the LAPACK environment variable.
  warnings.warn(LapackNotFoundError.__doc__)
c:\users\dell\appdata\local\temp\easy_install-rgjmx0\numpy-1.11.1\numpy\distutils\system_info.py:1562: UserWarning:
    Lapack (http://www.netlib.org/lapack/) sources not found.
    Directories to search for the sources can be specified in the
    numpy/distutils/site.cfg file (section [lapack_src]) or by setting
    the LAPACK_SRC environment variable.
  warnings.warn(LapackSrcNotFoundError.__doc__)
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
  warnings.warn(msg)
error: Setup script exited with error: [Error 2]

4.从网上下载了numpy.exe(numpy-1.8.1-win32-superpack-python2.7),但是估计是配置不兼容显示没有安装python。于是放弃使用easy-install,转战pip以便能装whl文件。

官网下载了pip-8.1.2.tar,进入相应目录下python setup.py install,安装成功。

5.从官网下载numpy-1.11.1+mkl-cp27-cp27m-win_amd64.whl(http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy),进入相应目录下python setup.py install,安装成功。

6.从官网下载(https://pypi.python.org/pypi/gensim#downloads),进入相应目录下python setup.py install,安装报错:

D:\compiler\Python>pip install gensim-0.13.1-cp27-cp27m-win_amd64.whl
Requirement already satisfied (use --upgrade to upgrade): gensim==0.13.1 from file:///D:/compiler/Python/gensim-0.13.1-cp27-cp27m-win_amd64.whl in c:\python27\lib\site-packages\gensim-0.13.1-py2.7-win-amd64.egg
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.3 in c:\python27\lib\site-packages (from gensim==0.13.1)
Collecting scipy>=0.7.0 (from gensim==0.13.1)
Exception:
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\commands\install.py", line 299, in run
    requirement_set.prepare_files(finder)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\req\req_set.py", line 370, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\req\req_set.py", line 522, in _prepare_file
    finder, self.upgrade, require_hashes)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\req\req_install.py", line 268, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\index.py", line 442, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\index.py", line 400, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\index.py", line 545, in _get_pages
    page = self._get_page(location)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\index.py", line 648, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\index.py", line 757, in get_page
    "Cache-Control": "max-age=600",
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\sessions.py", line 487, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\download.py", line 378, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\sessions.py", line 617, in send
    r.content
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\models.py", line 741, in content
    self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\models.py", line 664, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 353, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\requests\packages\urllib3\response.py", line 310, in read
    data = self._fp.read(amt)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\cachecontrol\filewrapper.py", line 54, in read
    self.__callback(self.__buf.getvalue())
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\cachecontrol\controller.py", line 297, in cache_response
    self.serializer.dumps(request, response, body=body),
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\download.py", line 281, in set
    return super(SafeFileCache, self).set(*args, **kwargs)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\cachecontrol\caches\file_cache.py", line 99, in set
    with self.lock_class(name) as lock:
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\lockfile\mkdirlockfile.py", line 19, in __init__
    LockBase.__init__(self, path, threaded, timeout)
  File "C:\Python27\lib\site-packages\pip-8.1.2-py2.7.egg\pip\_vendor\lockfile\__init__.py", line 242, in __init__
    hash(self.path)))
  File "C:\Python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

7.转用easyinstall安装还是报错,发现是因为scipy没装:

D:\compiler\Python>easy_install gensim
Searching for gensim
Best match: gensim 0.13.1
Processing gensim-0.13.1-py2.7-win-amd64.egg
gensim 0.13.1 is already the active version in easy-install.pth


Using c:\python27\lib\site-packages\gensim-0.13.1-py2.7-win-amd64.egg
Processing dependencies for gensim
Searching for scipy>=0.7.0
Reading https://pypi.python.org/simple/scipy/
error: ('The read operation timed out',)

8.下载scipy-0.15.1-cp27-none-win_amd64.whl,用pip安装,安装成功

9.进入gensim文件夹,安装还是有问题:

Installed c:\python27\lib\site-packages\gensim-0.12.2-py2.7-win-amd64.egg
Processing dependencies for gensim==0.12.2
Searching for bz2file
Reading https://pypi.python.org/simple/bz2file/
Best match: bz2file 0.98
Downloading https://pypi.python.org/packages/61/39/122222b5e85cd41c391b68a99ee296584b2a2d1d233e7ee32b4532384f2d/bz2file-0.98.tar.gz#md5=27d6f711ae0db6cfd1eb37f95621dfb5
error: Download error for https://pypi.python.org/packages/61/39/122222b5e85cd41c391b68a99ee296584b2a2d1d233e7ee32b4532384f2d/bz2file-0.98.tar.gz#md5=27d6f711ae0db6cfd1eb37f95621dfb5: ('_ssl.c:574: The handshake operation timed out',)

10.用easy_install安装报错:

C:\Users\dell>easy_install gensim

Searching for gensim
Best match: gensim 0.13.1
Processing gensim-0.13.1-py2.7-win-amd64.egg
gensim 0.13.1 is already the active version in easy-install.pth


Using c:\python27\lib\site-packages\gensim-0.13.1-py2.7-win-amd64.egg
Processing dependencies for gensim
Searching for boto>=2.32
Reading https://pypi.python.org/simple/boto/
Best match: boto 2.42.0
Downloading https://pypi.python.org/packages/c4/bb/28324652bedb4ea9ca77253b84567d1347b54df6231b51822eaaa296e6e0/boto-2.42.0.tar.gz#md5=62b6ef1af3d18f8811f97e311b856dad
error: ('The read operation timed out',)

11.官网下载了boto-2.42.0-py2.py3-none-any.whl(https://pypi.python.org/simple/boto/),用pip安装成功

12.再用easy_install安装gensim,成功安装。

13.进入eclipse,运行例程(https://radimrehurek.com/gensim/tutorial.html),虽然引用会报错,但是运行没问题,能打印出答案。我猜可能是pydev的bug,会误报错,像sys.setdefaultencoding('utf-8')这条语句就会误报错,但是运行完全没问题。

# -*- coding:utf-8 -*-
'''
Created on 2016年7月28日


@author: dell
'''
from gensim import corpora, models, similarities


corpus = [[(0, 1.0), (1, 1.0), (2, 1.0)],
           [(2, 1.0), (3, 1.0), (4, 1.0), (5, 1.0), (6, 1.0), (8, 1.0)],
           [(1, 1.0), (3, 1.0), (4, 1.0), (7, 1.0)],
           [(0, 1.0), (4, 2.0), (7, 1.0)],
           [(3, 1.0), (5, 1.0), (6, 1.0)],
           [(9, 1.0)],
           [(9, 1.0), (10, 1.0)],
           [(9, 1.0), (10, 1.0), (11, 1.0)],
           [(8, 1.0), (10, 1.0), (11, 1.0)]]
tfidf = models.TfidfModel(corpus)
vec = [(0, 1), (4, 1)]
print(tfidf[vec])

好了,过程都记录下来了,好记性不如烂笔头。

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值