2017-04-09 81 views
0

我想安裝使用點的monary python包。當我運行命令錯誤點安裝monary

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\ 

回答

2

https://monary.readthedocs.io/installation.html 您可以使用畫中畫在Windows以外的平臺上安裝monary:

$ PIP安裝monary

Monary使用pkgconfig來查找libmongoc和libbson安裝。如果pkgconfig無法找到這些庫,它將查找默認位置:Windows的C:\ Program Files \ libmongoc和C:\ Program Files \ libbson,而其他系統則位於/ 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。

+0

按照默認安裝說明安裝mongo c驅動程序,將其保存到目錄C:/ mongo-c-driver(http://mongoc.org/libmongoc/current/installing.html);是否需要將其重命名爲libmongoc以供pkgconfig查找? – boop

+0

不,只要按照說明安裝所有依賴項,它就可以工作。 –

+0

出於某種原因,我無法使pkg-config正常工作,但傳遞默認目錄並沒有辦法。謝謝! – boop