python word2vec没有安装

问题描述 投票:7回答:6

我一直在尝试使用我的Python2.7解释器在我的Windows 7机器上安装word2vec:https://github.com/danielfrg/word2vec

我已经尝试从解压缩目录下载zip和运行python setup.py安装并运行pip install。但是在这两种情况下都会返回以下错误:

Downloading/unpacking word2vec
  Downloading word2vec-0.5.1.tar.gz
  Running setup.py egg_info for package word2vec
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "c:\users\georgioa\appdata\local\temp\pip_build_georgioa\word2vec\setup.py", line 17, in <module>
        subprocess.call(['make', '-C', 'word2vec-c'])
      File "C:\Python27\lib\subprocess.py", line 524, in call
        return Popen(*popenargs, **kwargs).wait()
      File "C:\Python27\lib\subprocess.py", line 711, in __init__
        errread, errwrite)
      File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
        startupinfo)
    WindowsError: [Error 2] The system cannot find the file specified
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>
  File "c:\users\georgioa\appdata\local\temp\pip_build_georgioa\word2vec\setup.py", line 17, in <module>
    subprocess.call(['make', '-C', 'word2vec-c'])
  File "C:\Python27\lib\subprocess.py", line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:\Python27\lib\subprocess.py", line 711, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 948, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

访问subprocess.call()似乎有问题,所以经过一些谷歌搜索我设法将shell=True添加到word2vec setup.py的行,然后它抛出此错误:

'make' is not recognized as an internal or external command,
operable program or batch file.
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
running install_lib
running install_data
error: can't copy 'bin\word2vec': doesn't exist or not a regular file 

说实话,我甚至不确定我应该从哪里开始。我也尝试在安装中安装make并将路径变量设置为.exe文件,非常感谢任何建议,谢谢。

更新:

虽然word2vec模块不起作用,一个名为genism的软件包似乎工作得很好,但它也有一些很棒的其他NLP功能http://radimrehurek.com/gensim/

python pip gnuwin32 word2vec
6个回答
11
投票

word2vec适用于Linux。见:https://github.com/danielfrg/word2vec

在底部,它表示有一个非常实验性的Windows构建:支持:https://github.com/zhangyafeikimi/word2vec-win32

编辑:

看起来你也可以安装gensim:https://pypi.python.org/pypi/gensim

然后做:

from gensim.models import word2vec

3
投票

对我来说,这种方法适用于Win 7和Win 8。

  1. 安装Anaconda 64位(Python版本2.7)
  2. 安装MinGW Basic编译器(确保在安装列表中选择C和C ++编译器)
  3. 使用命令“conda install gensim”在Anaconda上重新安装gensim然后你可以打开ipython-notebook并尝试使用word2vec运行python代码,它应该可以工作。

1
投票

使用pip安装python库是一种很好的方法。

1.安装点子

A)以管理员身份启动命令提示符

  1. 单击开始,单击所有程序,然后单击附件。
  2. 用鼠标右键单击命令提示符,然后单击以管理员身份运行。
  3. 如果出现“用户帐户控制”对话框,请确认其显示的操作是您所需的操作,然后单击“继续”。

B)下载get-pip.py,小心将其保存为.py文件而不是.txt。然后,从命令提示符运行它。

python get-pip.py

下载get-pip.py,并将其保存为get-pip.py(不是get-pip.txt)。

从命令提示符运行它。

python get-pip.py

2.安装word2vec

现在你可以安装它

pip install word2vec

0
投票

看起来这个包包含C代码并调用UN * X makefile,所以它还没有为Windows编写。您可以尝试查找预编译的Windows二进制文件。


0
投票

我能够使用Cygwin在Windows上成功编译并运行原始的word2vec代码(https://github.com/dav/word2vec)。也就是说,无论如何我更喜欢gensim包 - 它与UTF-8没有问题,而原始代码在非ASCII字符上窒息。


0
投票

qazxsw poi来自qazxsw poi并且大多安装的scipy版本是word2vec

对于anaconda,您需要使用此命令qazxsw poi下载qazxsw poi

这将安装你当前的scipy版本...

然后你需要使用这个命令qazxsw poi安装qazxsw poi

我希望这能帮到您...

© www.soinside.com 2019 - 2024. All rights reserved.