我试图使用pip安装monary python包。当我运行命令
pip install monary
这是完整输出
C:\Users\krist>pip install monary
Collecting monary
Using cached Monary-0.5.0.tar.gz
Requirement already satisfied: pymongo in c:\users\krist\anaconda3\lib\site-packages (from monary)
Requirement already satisfied: numpy in c:\users\krist\anaconda3\lib\site-packages (from monary)
Building wheels for collected packages: monary
Running setup.py bdist_wheel for monary ... error
Complete output from command c:\users\krist\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krist\\AppData\\Local\\Temp\\pip-build-xkxevy62\\monary\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d
C:\Users\krist\AppData\Local\Temp\tmp2hws0x_vpip-wheel- --python-tag cp35:
C:\Users\krist\AppData\Local\Temp\pip-build-xkxevy62\monary\setup.py:90:
UserWarning: WARNING: the python package pkgconfig is not installed. If you
have pkg-config installed on your system, please install the python's pkgconfig, e.g. "pip install pkgconfig". Will use libmongoc=C:/Program Files\libmongoc and libbson=C:/Program Files\libbson instead.
% (mongoc_src, bson_src)))
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\monary
copying monary\datehelper.py -> build\lib.win-amd64-3.5\monary
copying monary\monary.py -> build\lib.win-amd64-3.5\monary
copying monary\monary_param.py -> build\lib.win-amd64-3.5\monary
copying monary\ordereddict.py -> build\lib.win-amd64-3.5\monary
copying monary\write_concern.py -> build\lib.win-amd64-3.5\monary
copying monary\__init__.py -> build\lib.win-amd64-3.5\monary
running build_ext
building 'monary.libcmonary' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\monary
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:/Program Files\libmongoc\include\libmongoc-1.0" "-IC:/Program Files\libbson\include\libbson-1.0" -Ic:\users\krist\anaconda3\include -Ic:\users\krist\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /Tcmonary\cmonary.c /Fobuild\temp.win-amd64-3.5\Release\monary\cmonary.obj -fPIC -O2 -DNDEBUG
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
cmonary.c
monary\cmonary.c(8): fatal error C1083: Cannot open include file: 'mongoc.h':
No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for monary
Running setup.py clean for monary
Failed to build monary
Installing collected packages: monary
Running setup.py install for monary ... error
Complete output from command c:\users\krist\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krist\\AppData\\Local\\Temp\\pip-build-xkxevy62\\monary\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krist\AppData\Local\Temp\pip-9enpcfz5-record\install-record.txt --single-version-externally-managed --compile:
C:\Users\krist\AppData\Local\Temp\pip-build-xkxevy62\monary\setup.py:90: UserWarning: WARNING: the python package pkgconfig is not installed. If you have pkg-config installed on your system, please install the python's pkgconfig, e.g. "pip install pkgconfig". Will use libmongoc=C:/Program Files\libmongoc and libbson=C:/Program Files\libbson instead.
% (mongoc_src, bson_src)))
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\monary
copying monary\datehelper.py -> build\lib.win-amd64-3.5\monary
copying monary\monary.py -> build\lib.win-amd64-3.5\monary
copying monary\monary_param.py -> build\lib.win-amd64-3.5\monary
copying monary\ordereddict.py -> build\lib.win-amd64-3.5\monary
copying monary\write_concern.py -> build\lib.win-amd64-3.5\monary
copying monary\__init__.py -> build\lib.win-amd64-3.5\monary
running build_ext
building 'monary.libcmonary' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\monary
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:/Program Files\libmongoc\include\libmongoc-1.0" "-IC:/Program Files\libbson\include\libbson-1.0" -Ic:\users\krist\anaconda3\include -Ic:\users\krist\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.14393.0\winrt" /Tcmonary\cmonary.c /Fobuild\temp.win-amd64-3.5\Release\monary\cmonary.obj -fPIC -O2 -DNDEBUG
cl : Command line warning D9002 : ignoring unknown option '-fPIC'
cmonary.c
monary\cmonary.c(8): fatal error C1083: Cannot open include file: 'mongoc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\krist\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krist\\AppData\\Local\\Temp\\pip-build-xkxevy62\\monary\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krist\AppData\Local\Temp\pip-9enpcfz5-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\krist\AppData\Local\Temp\pip-build-xkxevy62\monary\
我尝试卸载并重新安装MS Visual Studio,但我不知道failed with exit status 2
的确切含义,而且我不确定如何修复错误:
monary\cmonary.c(8): fatal error C1083: Cannot open include file: 'mongoc.h': No such file or directory
如何下载此软件包需要做什么?
更新: 我注意到安装pkgconfig
并发出警告,但最终结果没有改变 - 最后的错误仍然相同:
monary\cmonary.c(8): fatal error C1083: Cannot open include file: 'mongoc.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\krist\anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krist\\AppData\\Local\\Temp\\pip-build-xkxevy62\\monary\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krist\AppData\Local\Temp\pip-9enpcfz5-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\krist\AppData\Local\Temp\pip-build-xkxevy62\monary\
答案 0 :(得分:2)
https://monary.readthedocs.io/installation.html 您可以使用pip在Windows以外的平台中安装monary:
$ pip install monary
Monary使用pkgconfig查找libmongoc和libbson安装。如果pkgconfig找不到库,它将查找默认位置:C:\ Program Files \ libmongoc和C:\ Program Files \ libbson for Windows,/ usr / local用于其他系统。如果您无法使用pkgconfig并且libmongoc和libbson未安装在默认目录中,则需要将位置传递给安装脚本:
$ python setup.py install --default-libmongoc C:\ usr --default-libbson C:\ usr 如果您通过pip进行安装,并且libcmongo和libbson未安装在默认目录中,则必须使用--install-option将--default-libmongoc和--default-libbson传递给pip。