本文介绍了python word2vec未安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've been trying to install word2vec on my Windows 7 machine using my Python2.7 interpreter: https://github.com/danielfrg/word2vec

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

I've tried downloading the zip & running python setup.py install from the unzipped directory and running pip install. however in both instances it returns the below errors:

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添加到该行中,然后抛出此错误:

There seemed to be a problem accessing subprocess.call(), so after a bit of googling I managed to add shell=True to the line the the word2vec setup.py and it then throws this error:

'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,并在安装过程中将path变量设置为.exe文件,非常感谢任何建议.

To be honest I'm not even sure where I should go from here. I've also tried installing make and setting the path variable to the .exe file in the install, any advice would be greatly appreciated, thanks.

更新:

虽然word2vec模块无法正常运行,但名为genism的软件包似乎运行良好,但它也具有其他一些NLP功能, http://radimrehurek.com/gensim/

While the word2vec module wouldn't work a package called genism seems to work pretty well, it's got some great other NLP functionality too http://radimrehurek.com/gensim/

推荐答案

单词2vec用于Linux.参见: https://github.com/danielfrg/word2vec

The word2vec is meant for Linux. See: https://github.com/danielfrg/word2vec

底部表示有一个非常试验性的Windows构建,位于:support: https://github. com/zhangyafeikimi/word2vec-win32

At the bottom it says there is a very experimental Windows build at: support:https://github.com/zhangyafeikimi/word2vec-win32

好像您也可以安装gensim: https://pypi.python.org/pypi/gensim

Looks like you can also install gensim: https://pypi.python.org/pypi/gensim

然后做:

from gensim.models import word2vec

这篇关于python word2vec未安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 07:49