如何在 Windows 7 上安装 Gensim

How to install Gensim on Windows 7

我有 Windows 7 和 WinPython 3.4.3.2;尝试从 http://www.lfd.uci.edu/~gohlke/pythonlibs/#gensim

安装 Gensim

我收到这个错误:

C:\Program Files (x86)\PowerCmd>pip install e:\Python\gensim-0.12.1-cp34-none-win_amd64.whl
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Processing e:\python\gensim-0.12.1-cp34-none-win_amd64.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.2.0 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages (from gensim==0.12.1)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.3 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages (from gensim==0.12.1)
Collecting smart-open>=1.2.1 (from gensim==0.12.1)
  Using cached smart_open-1.2.1.tar.gz
Traceback (most recent call last):
  File "<string>", line 20, in <module>
  File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 28, in <module>
    long_description = read('README.rst'),
  File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 21, in read
    return open(os.path.join(os.path.dirname(__file__), fname)).read()
  File "M:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\encodings\cp1251.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 4345: character maps to <undefined>
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 28, in <module>
        long_description = read('README.rst'),
      File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 21, in read
        return open(os.path.join(os.path.dirname(__file__), fname)).read()
      File "M:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\encodings\cp1251.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 4345: character maps to <undefined>
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

      File "<string>", line 20, in <module>

      File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 28, in <module>

        long_description = read('README.rst'),

      File "C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open\setup.py", line 21, in read

        return open(os.path.join(os.path.dirname(__file__), fname)).read()

      File "M:\WinPython-64bit-3.4.3.2\python-3.4.3.amd64\lib\encodings\cp1251.py", line 23, in decode

        return codecs.charmap_decode(input,self.errors,decoding_table)[0]

    UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 4345: character maps to <undefined>

    ----------------------------------------
    Command "python setup.py egg_info" failed with error code 1 in C:\Users\Joomler\AppData\Local\Temp\pip-build-49b17fh6\smart-open

错误消息表明,这可能是 Python3 'on windows' 兼容性错误。

我从 setup.py.

手动安装了 https://pypi.python.org/pypi/smart_open

文件有问题README.rst - 我删除了其中的所有数据,以确保不会打印出错误字符。

现在我需要手动安装 Gensim,因为它会自动下载 smart_open。不幸的是,我无法 import gensim。我遇到以下错误:

ImportError: No module named 'gensim'

但是如果我执行 pip install -U gensim 我可以看到所有要求都已满足:

Requirement already up-to-date: gensim in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\gensim-0.12.1-py3.4-win-amd64.egg
Requirement already up-to-date: numpy>=1.3 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages (from gensim)
Requirement already up-to-date: scipy>=0.7.0 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages (from gensim)
Requirement already up-to-date: six>=1.5.0 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages (from gensim)
Requirement already up-to-date: smart-open>=1.2.1 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\smart_open-1.2.1-py3.4.egg (from gensim)
Requirement already up-to-date: boto>=2.32 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\boto-2.38.0-py3.4.egg (from smart-open>=1.2.1->gensim)
Requirement already up-to-date: httpretty==0.8.6 in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\httpretty-0.8.6-py3.4.egg (from smart-open>=1.2.1->gensim)
Requirement already up-to-date: bz2file in m:\winpython-64bit-3.4.3.2\python-3.4.3.amd64\lib\site-packages\bz2file-0.98-py3.4.egg (from smart-open>=1.2.1->gensim)

有什么提示吗?

编辑 15/08/2015:安装成功。我只需要清理旧的尝试并重新安装。