mac安装百度Python SDK的坑
本文最后更新于:2020年9月16日 上午
摘要
本文记录了macOS Catalina
安装baidu Python SDK的坑,主要是安装pycrypto
坑太深了,折腾了好久。
系统
macOS Catalina
版本10.15.2
出问题的关键点
查看了百度的文档,说需要先安装依赖——**pycrypto
**,就是这个东西其坑无比。上来不管三七二十一,直接pip安装pycrypto,结果一大堆报错,然后直接去google pycrypto mac,安装了什么gmp之类的,结果牛头不对马嘴,问题还是没有解决,最后还是返回去看一大堆报错,报错中如下信息比较重要:
1 |
|
直觉上觉得是gcc有问题,于是通过brew
安装gcc:
1 |
|
真的,看到又出错,真的冒火,索性log里面直接有提示,需要安装xcode,如下安装xcode即可:
1 |
|
输入xcode-select --install
后,会弹出图形界面,按照提示安装就行了,安装完成查看gcc版本:
1 |
|
其实发现并不是gcc,是clang,不过不影响接下来安装pycrypto
了。
安装SDK过程
安装了xcode
后就可以正常安装SDK了:
安装pycrypto
1
2
3
4
5
6
7
8scarleastdeMacBook-Pro:hexo_auto scarleast$ pip3.6 install pycrypto
Collecting pycrypto
Using cached https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz
Installing collected packages: pycrypto
Running setup.py install for pycrypto ... done
Successfully installed pycrypto-2.6.1
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.安装百度SDK
1
2
3
4
5
6
7
8
9
10
11scarleastdeMacBook-Pro:hexo_auto scarleast$ pip3.6 install bce-python-sdk
Collecting bce-python-sdk
Using cached https://files.pythonhosted.org/packages/04/a6/72a4bbe372de7438978f5dd976f3a4981cd245d7995112b31bb77aa41656/bce_python_sdk-0.8.32-py2.py3-none-any.whl
Collecting six>=1.4.0 (from bce-python-sdk)
Using cached https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl
Requirement already satisfied: future>=0.6.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from bce-python-sdk) (0.18.2)
Requirement already satisfied: pycrypto>=2.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from bce-python-sdk) (2.6.1)
Installing collected packages: six, bce-python-sdk
Successfully installed bce-python-sdk-0.8.32 six-1.13.0
You are using pip version 10.0.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
尾巴
哎,现在搞得人有点冒火,最后因为xcode的问题,没办法编译,导致的报错。还是那句话吧,出问题了先看日志,先看日志,先看日志!!!!