install python module using a zip file

后端 未结 6 1566
悲&欢浪女
悲&欢浪女 2020-12-16 14:18

I have downloaded a zip file from here but I don\'t know how to install it and then use it in my python 2.7 they said it supports both python 2 and 3

using command:

相关标签:
6条回答
  • 2020-12-16 14:46

    As far as I know, hazm 0.5 uses libwapiti for its POS Tagger class and I'd the exact same related problem installing hazm over Windows 7. For Python 2.7, you've got to use MS VC++ 2008 (a.k.a 9.00) for Python 2.7 (available on Microsoft's site) for some packages including hazm. But the pain won't be finished here! MSVC9 does not have some C++ header files like stdbool.h and a few others which you've got to create or copy-paste manually in MSVC installition folder. If you want to use hazm 0.5, the best you can do is to install and use it on Linux:

    sudo pip install hazm
    

    or

    sudo pip3 install hazm
    

    But if you need to use it under Windows OS you can use hazm 0.4 which does not need the troublesome libwapiti module as recommanded by hazm's creator:

    pip install hazm==0.4
    
    0 讨论(0)
  • 2020-12-16 14:50

    The right way to install a zipfile (at least if it's properly designed, but I just tested this one, and it is) is with pip:

    pip install hazm-master.zip
    

    Or, if you prefer, you can unzip it and use pip from within the directory:

    unzip hazm-master.zip
    cd hazm-master
    pip install .
    

    But neither of these is really necessary, because, as the project's readme says, you don't need to download it manually; just do:

    pip install hazm
    
    0 讨论(0)
  • 2020-12-16 14:53

    In order to install hazm, you need to install all of its prerequisites.

    If you install it with pip install hazm or pip install hazm-master.zip, pip will try to fetch and install all of them for you. If you unzip it and run setup.py manually, you have to take care of figuring out and installing all the prerequisites on your own (and possibly telling hazm how to find them); that isn't going to solve anything.

    Your problem appears to be with libwapiti, which requires a C compiler, and presumably also the Wapiti C library. I'm not actually sure that Wapiti and libwapiti actually work natively on Windows at all. Maybe they do, but if not, all you can do is port them yourself, file a feature request on their issue trackers, or use Cygwin instead of native Windows.

    At any rate, if they support Windows, what you need to do should be:

    • Download, make, and install Wapiti (see the link above, and read the instructions on their website or inside the package).
    • pip install hazm again.
    0 讨论(0)
  • 2020-12-16 14:56

    Based on my experience - after several times that I'd to reinstall Windows/Ubuntu and so Python and its packages including hazm, I'd avoid going for its new version due some of its prerequisites which made me several problems before I figure them out. For Ubuntu it was okay but for Windows I couldn't collect and setup all prerequisites like wapiti and libwapiti. I suggest installing and using hazm 0.4 or 0.3. Not every update makes life easier, believe me!

    0 讨论(0)
  • 2020-12-16 14:57

    I checked libwapiti and it seems to be working just on linux. because of that i couden't install hazm on windows. at last i could install hazm on linux.

    0 讨论(0)
  • 2020-12-16 15:05

    This package is on PyPI, so all you have to do is run the following command:

    pip install hazm
    pip2 install hazm #Explicit python 2 selection
    pip3 install hazm #Explicit python 3 selection
    

    If you really want to use that file, you have to run the setup.py file, you can do this using the following command (assuming you are in the hazm-master folder):

    python ./setup.py
    python2 ./setup.py #Explicit python 2 selection
    python3 ./setup.py #Explicit python 3 selection
    
    0 讨论(0)
提交回复
热议问题