Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

pip - python word2vec not installing

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

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:usersgeorgioaappdatalocalemppip_build_georgioaword2vecsetup.py", line 17, in <module>
        subprocess.call(['make', '-C', 'word2vec-c'])
      File "C:Python27libsubprocess.py", line 524, in call
        return Popen(*popenargs, **kwargs).wait()
      File "C:Python27libsubprocess.py", line 711, in __init__
        errread, errwrite)
      File "C:Python27libsubprocess.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:usersgeorgioaappdatalocalemppip_build_georgioaword2vecsetup.py", line 17, in <module>
    subprocess.call(['make', '-C', 'word2vec-c'])
  File "C:Python27libsubprocess.py", line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File "C:Python27libsubprocess.py", line 711, in __init__
    errread, errwrite)
  File "C:Python27libsubprocess.py", line 948, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

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:Python27libdistutilsdist.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 'binword2vec': doesn't exist or not a regular file 

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.

UPDATE:

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/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

EDIT:

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

Then do:

from gensim.models import word2vec

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...