使用zip文件安装python模块

moh*_*ani 12 python module pip

我从这里下载了一个zip文件,但我不知道如何安装它然后在我的python 2.7中使用它们说它支持python 2和3

使用命令:"pip install hazm"在一堆行之后得到这些错误:

creating build\temp.win-amd64-2.7\Release\libwapiti\src
C:\Users\Mohammad\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyt
hon\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Icwapiti/src -
Ilibwapiti -IC:\Python27\include -IC:\Python27\PC /Tccwapiti/src/bcd.c /Fobuild\
temp.win-amd64-2.7\Release\cwapiti/src/bcd.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
bcd.c
cwapiti/src/bcd.c(30) : fatal error C1083: Cannot open include file: 'stdboo
l.h': No such file or directory
error: command '"C:\Users\Mohammad\AppData\Local\Programs\Common\Microsoft\V
isual C++ for Python\9.0\VC\Bin\amd64\cl.exe"' failed with exit status 2

----------------------------------------
Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:
\\users\\mohammad\\appdata\\local\\temp\\pip-build-y3whx6\\libwapiti\\setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\
n'), __file__, 'exec'))" install --record c:\users\mohammad\appdata\local\temp\p
ip-m_wrwt-record\install-record.txt --single-version-externally-managed --compil
e" failed with error code 1 in c:\users\mohammad\appdata\local\temp\pip-build-y3
whx6\libwapiti
Run Code Online (Sandbox Code Playgroud)

当我使用命令:"python ./setup.py"时,这些错误会显示出来:

C:\Users\Mohammad\Desktop\Term 6\AI\AI Project\OPERATE\hazm-master\hazm-master>p
ython ./setup.py
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option:
'install_requires'
 warnings.warn(msg)
 usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
 or: setup.py --help [cmd1 cmd2 ...]
 or: setup.py --help-commands
 or: setup.py cmd --help

 error: no commands supplied
Run Code Online (Sandbox Code Playgroud)

aba*_*ert 29

安装zipfile的正确方法(至少如果设计得当,但我刚测试过这个,那就是)pip:

pip install hazm-master.zip
Run Code Online (Sandbox Code Playgroud)

或者,如果您愿意,可以解压缩并pip在目录中使用:

unzip hazm-master.zip
cd hazm-master
pip install .
Run Code Online (Sandbox Code Playgroud)

但这些都不是真的有必要,因为正如项目的自述文件所说,你不需要手动下载; 做就是了:

pip install hazm
Run Code Online (Sandbox Code Playgroud)

  • 在无法访问 Internet 的机器上,可能需要从 zip 安装!将 zip 下载到其他机器,将其传输到被阻止的机器,然后安装。 (5认同)

小智 1

该软件包位于 PyPI 上,因此您所要做的就是运行以下命令:

pip install hazm
pip2 install hazm #Explicit python 2 selection
pip3 install hazm #Explicit python 3 selection
Run Code Online (Sandbox Code Playgroud)

如果您确实想使用该文件,则必须运行该setup.py文件,可以使用以下命令来执行此操作(假设您位于 hazm-master 文件夹中):

python ./setup.py
python2 ./setup.py #Explicit python 2 selection
python3 ./setup.py #Explicit python 3 selection
Run Code Online (Sandbox Code Playgroud)