[英]Error installing python-snappy: snappy-c.h: No such file or directory
I am using amazon ec2 ubuntu 11.04 server我正在使用亚马逊 ec2 ubuntu 11.04 服务器
sudo pip install python-snappy
also I tried to downloaded package and entered "sudo python setup.py install"我也尝试下载 package 并输入“sudo python setup.py install”
I got the error:我得到了错误:
running build
running build_ext
building 'snappy' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for Ada/C/ObjC but not for C++ [enabled by default]
snappymodule.cc:31:22: fatal error: snappy-c.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
How i could get rid of this error?我怎样才能摆脱这个错误?
source: https://github.com/andrix/python-snappy来源: https://github.com/andrix/python-snappy
You can install Snappy C library with following commands:您可以使用以下命令安装 Snappy C 库:
DEB-based: sudo apt-get install libsnappy-dev
基于 DEB:
sudo apt-get install libsnappy-dev
RPM-based: sudo yum install libsnappy-devel
基于 RPM:
sudo yum install libsnappy-devel
Brew: brew install snappy
brew:
brew install snappy
How to install it on Mac OS X?如何在 Mac OS X 上安装它?
It has been reported a few times (Issue #7 and #23) that it can't be installed correctly the library in Mac.已多次报告(问题 #7 和 #23)无法在 Mac 中正确安装库。 The procedure should be,
程序应该是,
$ brew install snappy # snappy library from Google
$ CPPFLAGS="-I/usr/local/include -L/usr/local/lib" pip install python-snappy
You need Snappy C library你需要 Snappy C库
Then you have to install python-snappy wrapper.然后你必须安装 python-snappy 包装器。
It seems you didn't install Snappy-C library看来你没有安装 Snappy-C 库
Try it ..as already a fellow commented for your post试试吧..因为已经有人评论了你的帖子
UPDATE: See more highly upvoted post below, which includes instructions to install on DEB-based, RPM-based, and Mac OS (Brew).
更新:请参阅下面更受好评的帖子,其中包括在基于 DEB、基于 RPM 和 Mac OS (Brew) 上安装的说明。
I had some trouble getting snappy to install.我在快速安装时遇到了一些麻烦。 Finally downloaded the pre-build stuff as offered by https://www.lfd.uci.edu/~gohlke/pythonlibs/ and all went well.
最后下载了https://www.lfd.uci.edu/~gohlke/pythonlibs/提供的预构建内容,一切顺利。 (Unofficial Windows Binaries for Python Extension Packages)
(Python 扩展包的非官方 Windows 二进制文件)
for Oracle Linux with Python 3.X:对于带有 Python 3.X 的 Oracle Linux:
you need to enable optional_latest repository as a first step,您需要启用 optional_latest 存储库作为第一步,
use for enabling the following repo用于启用以下 repo
$ yum-config-manager --enable ol7_optional_latest
"ol7_optional_latest" repo will be enabled for yum lookup. “ol7_optional_latest”repo 将启用 yum 查找。
then install packages using,然后使用安装包,
$ yum -y install gcc gcc-c++ snappy snappy-devel
then with pip install the python-snappy package,然后用 pip 安装 python-snappy 包,
$ pip3 install python-snappy
had lots of issues installing on El Capitan, with an error saying that the snappy-ch file was not found.在 El Capitan 上安装时遇到很多问题,错误提示找不到 snappy-ch 文件。
Had to install snappy from tar.gz file https://github.com/google/snappy/releases/download/1.1.3/snappy-1.1.3.tar.gz必须从 tar.gz 文件安装 snappy https://github.com/google/snappy/releases/download/1.1.3/snappy-1.1.3.tar.gz
untar and run解压并运行
./configure
make
make install
it will put the header file in /usr/local/include
它会将头文件放在
/usr/local/include
then needed to set FLAGS for the cc compiler to find the header file:然后需要为 cc 编译器设置 FLAGS 以找到头文件:
export DYLD_LIBRARY_PATH=/usr/local/include
export CPPFLAGS="-I/usr/local/include/snappy-c.h"
export CFLAGS="-I/usr/local/include/snappy-c.h"
export CXXFLAGS="-I/usr/local/include/snappy-c.h"
export LDFLAGS="-L/usr/local/lib"
and then I installed python-snappy from the egg file https://pypi.python.org/packages/b1/fe/1d632cdac5dbb5ce84db778af7f733eb469130d8cf4c02f6cd9057a96768/snappy-2.4.1-py2.7-macosx-10.5-intel.egg#md5=b76558c71f1d97feeb8402c345e466bf然后我安装了鸡蛋文件中的python-瞬间https://pypi.python.org/packages/b1/fe/1d632cdac5dbb5ce84db778af7f733eb469130d8cf4c02f6cd9057a96768/snappy-2.4.1-py2.7-macosx-10.5-intel.egg#md5=b76558c71f1d97feeb8402c345e466bf
you can try with pip install python-snappy
but it originally failed to find the header file, so i went for the egg file你可以尝试
pip install python-snappy
但它最初找不到头文件,所以我去了egg文件
to install the egg:安装鸡蛋:
easy_install <eggfile>
python setup.py build
python setup.py install
You need to check the output for您需要检查输出
rpm -q snappy-devel
If it is not present, then install it using this command:如果它不存在,则使用以下命令安装它:
yum install snappy-devel
If you are on Mac OS X Catalina , you can install with如果您使用的是Mac OS X Catalina ,则可以安装
brew install snappy
CPPFLAGS="-I/usr/local/include -L/usr/local/lib -stdlib=libc++ " pip install python-snappy
as suggested by https://github.com/andrix/python-snappy FAQ正如https://github.com/andrix/python-snappy FAQ 所建议的
这解决了我的问题:
yum install gcc-c++
I was having troubles with this for a while.我有一段时间遇到了这个问题。 FYI I'm trying to install Crossbar ( https://crossbar.io/docs/Installation-on-Linux/ )
仅供参考,我正在尝试安装 Crossbar( https://crossbar.io/docs/Installation-on-Linux/ )
I did a bunch of googling and messed around quite a bit.我做了一堆谷歌搜索并搞砸了很多。 I'm using Python 3.7.4 and what I think solved my problem is this :
我正在使用 Python 3.7.4,我认为解决了我的问题的是:
sudo yum install python-devel
if that doesn't work try如果那不起作用试试
sudo yum install python3-devel
source:来源:
https://github.com/giampaolo/psutil/issues/1143#issuecomment-475354786 https://github.com/giampaolo/psutil/issues/1143#issuecomment-475354786
https://github.com/giampaolo/psutil/issues/1143 https://github.com/giampaolo/psutil/issues/1143
To solve this issue in Mac OS X with MacPorts installed, you can do:要在安装了 MacPorts 的 Mac OS X 中解决此问题,您可以执行以下操作:
$ sudo port install snappy
$ CPPFLAGS="-I/opt/local/include -L/opt/local/lib" pip install python-snappy
Fix for macOS M1.修复了 macOS M1。 You have to define absolute path to lib and include for snappy.
您必须定义 lib 的绝对路径并包含 snappy。
brew install snappy
pip install \
--upgrade --ignore-installed \
python-snappy==0.5.4 \
--global-option=build_ext \
--global-option="-I/opt/homebrew/Cellar/snappy/1.1.9/include" \
--global-option="-L/opt/homebrew/Cellar/snappy/1.1.9/lib"
For Windows对于 Windows
Extract the Zip.提取 Zip。
Copy the .h
files from include folder.从 include 文件夹复制
.h
文件。 Paste in to the python installation folder C:\Users\user\AppData\Local\Programs\Python\Python310\include\
粘贴到python安装文件夹
C:\Users\user\AppData\Local\Programs\Python\Python310\include\
Copy snappy64.lib
from native folder.从本机文件夹复制
snappy64.lib
。 Paste in to python installation folder C:\Users\user\AppData\Local\Programs\Python\Python310\libs\
粘贴到 python 安装文件夹
C:\Users\user\AppData\Local\Programs\Python\Python310\libs\
Rename snappy64.lib
to snappy.lib
将
snappy64.lib
重命名为snappy.lib
you are good to go. Re-try command pip install -r.\requirements.txt
你对 go 很好。重试命令
pip install -r.\requirements.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.