[英]How to install snappy C libraries on Windows 10 for use with python-snappy in Anaconda?
I want to install parquet for python using pip within an Anaconda 2 installation on Windows 10. 我想在Windows 10上的Anaconda 2安装中使用pip 为python安装镶木地板 。
While installing I ran into the error that is described here , the installer can't find snappy-ch
. 在安装时遇到了此处描述的错误,安装程序找不到
snappy-ch
。
There is no mention on how to install this on Windows in the answers. 没有提到如何在答案中在Windows上安装它。
I downloaded the Snappy library from http://google.github.io/snappy/ and now I'm stuck. 我从http://google.github.io/snappy/下载了Snappy库,现在我被卡住了。
From my error message I would have assumed that the header files need to be in C:\\Users\\...\\AppData\\Local\\Continuum\\Anaconda2\\include
, but in the downlaoded archive header and library files are just all in the same folder. 从我的错误消息我会假设头文件需要在
C:\\Users\\...\\AppData\\Local\\Continuum\\Anaconda2\\include
,但在下层归档文件头和库文件中都是相同的夹。
How do I install these properly in the Anaconda folder? 如何在Anaconda文件夹中正确安装这些?
Full error message: 完整的错误消息:
Building wheels for collected packages: python-snappy
Running setup.py bdist_wheel for python-snappy ... error
Complete output from command C:\Users\...\AppData\Local\Continuum\Anaconda2\python.exe -u -c "import setup
tools, tokenize;__file__='c:\\users\\...\\appdata\\local\\temp\\pip-build-kl4zef\\python-snappy\\setup.py';f=ge
tattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec
'))" bdist_wheel -d c:\users\...\appdata\local\temp\tmpt8fz9bpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
copying snappy.py -> build\lib.win-amd64-2.7
running build_ext
building '_snappy' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Users\...\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nol
ogo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Users\...\AppData\Local\Continuum\Anaconda2\include -IC:\Users\...
\AppData\Local\Continuum\Anaconda2\PC /Tpsnappymodule.cc /Fobuild\temp.win-amd64-2.7\Release\snappymodule.obj
snappymodule.cc
snappymodule.cc(31) : fatal error C1083: Cannot open include file: 'snappy-c.h': No such file or directory
error: command 'C:\\Users\\...\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\V
C\\Bin\\amd64\\cl.exe' failed with exit status 2
After a really long and frustrating time trying different methods to get the C files working, I found this site: 经过一段非常漫长而令人沮丧的时间尝试不同的方法来使C文件正常工作之后,我找到了这个网站:
http://www.lfd.uci.edu/~gohlke/pythonlibs/ http://www.lfd.uci.edu/~gohlke/pythonlibs/
Where C. Gohlke has kindly compiled and uploaded the files for us windows users. C. Gohlke已经为我们的Windows用户编辑和上传文件。
Just download the version you need based on your system and python version. 只需根据您的系统和python版本下载所需的版本。 I am using 64bits and python 3.6, so I used the following command from my download folder:
我使用64位和python 3.6,所以我使用了下载文件夹中的以下命令:
pip install python_snappy-0.5-cp36-cp36m-win_amd64.whl
It worked like a charm :) 它像一个魅力:)
EDIT: Refer to the other answers in this thread, I only keep this up for reference. 编辑:请参阅此主题中的其他答案,我只是将其保留以供参考。
Here's the steps it took me to install Snappy and Python-Snappy on Windows 10: 以下是我在Windows 10上安装Snappy和Python-Snappy所采取的步骤:
AM_PROG_AR
into configure.ac
above LT_INIT
and run autogen.sh
from the cygwin terminal, install missing cygwin packages if needed. AM_PROG_AR
到configure.ac
以上LT_INIT
和运行autogen.sh
从Cygwin的终端,如果需要安装缺失cygwin的包。 snappy-ch
into the Anaconda2/include
folder and libsnappy.a
into the Anaconda2/Lib
folder (in ~/AppData/Local/Continuum/
). snappy-ch
复制到Anaconda2/include
文件夹中,将libsnappy.a
到Anaconda2/Lib
文件夹中(在~/AppData/Local/Continuum/
)。 stdint.h
was missing for Visual C++ Compiler for Python 2.7., I found it here and put it into ~\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\include
. stdint.h
。我在这里找到它并将其放入~\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\include
。 (Everything works fine now.) (现在一切正常。)
EDIT: No it does not. 编辑:不,不。 This method is not reliable, once you try to update you run into new problems.
此方法不可靠,一旦您尝试更新,您就会遇到新问题。 And installing on Python 3 is another monster that isn't tackled by this solution.
在Python 3上安装是另一个未被此解决方案解决的怪物。
It seems there are now Conda packages that should simplify things (in Anaconda). 似乎现在有Conda软件包可以简化事情(在Anaconda中)。 I was able to do (on Python 3.6, Windows 10):
我能够做到(在Python 3.6,Windows 10上):
conda install -c conda-forge snappy
conda install -c conda-forge python-snappy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.