编程语言
首页 > 编程语言> > Mac pip install python-snappy失败

Mac pip install python-snappy失败

作者:互联网

今天在Mac本上,安装python-snappy报了如下错误,记得之前没有,在网上搜索了一圈说是缺少snappy-c.h,具体的解决方法如下(原文参考链接 具体的解决方法 感谢):

brew install snappy          # 1、先用brew 安装 snappy
pip install python-snappy    # 2、在进行安装,即可

这是我的错误提示,希望可以帮到大家:

 pip install python-snappy
Collecting python-snappy
  Using cached python-snappy-0.6.0.tar.gz (21 kB)
Building wheels for collected packages: python-snappy
  Building wheel for python-snappy (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/xyl/opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/setup.py'"'"'; __file__='"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/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 /private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-wheel-uur8b72g
       cwd: /private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/
  Complete output (23 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.8
  creating build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/snappy.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/snappy_cffi.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/hadoop_snappy.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/snappy_formats.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  copying snappy/snappy_cffi_builder.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
  running build_ext
  building 'snappy._snappy' extension
  creating build/temp.macosx-10.9-x86_64-3.8
  creating build/temp.macosx-10.9-x86_64-3.8/snappy
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/xyl/opt/anaconda3/include -arch x86_64 -I/Users/xyl/opt/anaconda3/include -arch x86_64 -I/Users/xyl/opt/anaconda3/include/python3.8 -c snappy/snappymodule.cc -o build/temp.macosx-10.9-x86_64-3.8/snappy/snappymodule.o
  snappy/snappymodule.cc:32:10: fatal error: 'snappy-c.h' file not found
  #include <snappy-c.h>
           ^~~~~~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for python-snappy
  Running setup.py clean for python-snappy
Failed to build python-snappy
Installing collected packages: python-snappy
    Running setup.py install for python-snappy ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/xyl/opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/setup.py'"'"'; __file__='"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-record-0whs1afj/install-record.txt --single-version-externally-managed --compile --install-headers /Users/xyl/opt/anaconda3/include/python3.8/python-snappy
         cwd: /private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/
    Complete output (23 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/snappy.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/snappy_cffi.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/hadoop_snappy.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/snappy_formats.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/__main__.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    copying snappy/snappy_cffi_builder.py -> build/lib.macosx-10.9-x86_64-3.8/snappy
    running build_ext
    building 'snappy._snappy' extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/snappy
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/xyl/opt/anaconda3/include -arch x86_64 -I/Users/xyl/opt/anaconda3/include -arch x86_64 -I/Users/xyl/opt/anaconda3/include/python3.8 -c snappy/snappymodule.cc -o build/temp.macosx-10.9-x86_64-3.8/snappy/snappymodule.o
    snappy/snappymodule.cc:32:10: fatal error: 'snappy-c.h' file not found
    #include <snappy-c.h>
             ^~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/xyl/opt/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/setup.py'"'"'; __file__='"'"'/private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-install-_n3ew0xm/python-snappy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/d4/ykh_5r7j6214f7sts5sxj_x00000gp/T/pip-record-0whs1afj/install-record.txt --single-version-externally-managed --compile --install-headers /Users/xyl/opt/anaconda3/include/python3.8/python-snappy Check the logs for full command output.

声明: 总结学习,有问题或不当之处,可以批评指正哦,谢谢。

标签:x86,python,py,Mac,snappy,64,build
来源: https://blog.csdn.net/XX_123_1_RJ/article/details/113788462