简体   繁体   中英

How to install python-Levenshtein or other C/C++ packages on Win 7 64 bit

This is driving me completely nuts. I have looked at several answers to questions relating to this, but when I try the solutions non works.
First I tried a simple pip install python-Levenshtein . This this produced a lot of spam ending with Unable to find vcvarsall.bat Searching on that suggested I need to install Visual C++ 10.0; but when I tried that it errored out as apparently I already have a newer version installed. Then I found answers based on something called 'wheel'. This page python libs lists 8 .whl files for this module with NO explanation as to what each one is for. I tried the first two and got the same response on each: ...whl is not a supported wheel on this platform

What I need is simple directions, that the proverbial small child could understand, as to how to install this module.

I am running Python 3.3, on a Win 7 64 bit machine. (I also have Python 2.7 and 2.4 installed but those are for other projects). I do not use C++ directly for anything so have no knowledge of how its installed on my machine, I imagine it was either part of the OS or came with Python or some other package. It seems to me that a Python module that relies on a C++ runtime would require the user to have any knowledge of C++ and would be completely 'self-contained'. So, what am I missing?

I have win10 64 bit python 3.5 I have installed python-Levenshtein (0.12.0) using Visual studio 14. But there are compiled binaries already.

python-levensthtein

(This answer is for those who like me need basic step-by-step. While I found a number of bits of the puzzle in other answers and pip / wheel documentation, I didn't find a complete step-by-step. It uses 'wheels' which based on this experience seems to be simpler or more robust than the other methods.).

While I still don't know how to fix the C++ issue raised by simple pip install, I was able to do it using wheel. What I eventually figured out is how to parse the file names in Python wheel object libs . (The Fine Manual glossed over this). The -cp nn - part of the name is the Python version number - cp33 for Python 3.3. win32 was pretty clear so I had figured out win amd64 was for 64 bit systems though I've no idea what amd means.

So for Python 3.3 on a Windows 64 bit system the file I needed was
python Levenshtein-0.12.0-cp33-none-win amd64.whl
[I still don't know the significance of none , the Fine Manual is silent on that too. Perhaps it means nothing...]

Step by step the process was:

  • From python Levenshtein wheels download the relevant .whl
    ( python_Levenshtein-0.12.0-cp33-none-win_amd64.whl in my case)
  • Create a wheels directory (or whatever name you like) under the Python33 directory ( Python33/wheels )
  • copy or move the .whl file from download folder to the wheels folder.
  • Create a .bat file in Python33 directory, eg ... Python33/piplev.bat with the following lines (assuming \\Python33 is the root dir for Python)

cd \\Python33

pip install --use-wheel --no-index --find-links=wheels wheels/python_Levenshtein-0.12.0-cp33-none-win_amd64.whl

  • double click on the .bat file.

  • You should get output like this in the cmd window:

C:\\Python33>

C:\\Python33>pip install --use-wheel --no-index --find-wheels wheels/python_Levenshtein-0.12.0-cp33-none-win_amd64.whl

Ignoring indexes: https://pypi.python.org/simple

Processing c:\\python33\\wheels\\python_levenshtein-0.12.0-cp33-none-win_amd64. whl

Installing collected packages: python-Levenshtein

Successfully installed python-Levenshtein-0.12.0

Actually since I will likely want to install other packages with C++ I components, I made a generalised bat file pipwheel.bat :

cd \\Python33

pip install --use-wheel --no-index --find-links=wheels wheels/%1.whl

and then instead of double clicking the bat file I just open a cmd: window and type

pipwheel package-name

(The root directory for Python - Python33 should by in the windows path, if it isnt you should first navigate to the Python33 directory)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM