mac下python3 django源码安装测试

https://docs.djangoproject.com/zh-hans/2.2/intro/contributing/
安装测试模块时报异常 pip install -r requirements/py3.txt

   

building '_pylibmc' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DUSE_ZLIB -I/Users/zyc/.virtualenvs/djangodev/include -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/_pylibmcmodule.c -o build/temp.macosx-10.9-x86_64-3.7/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
    In file included from src/_pylibmcmodule.c:34:
    src/_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
    #include <libmemcached/memcached.h>
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1


需要安装 brew,openssl,libevent-2.0.22-stable.tar.gz,memcached-1.5.12,pylibmc,不知道是否要安装gcc,我也安装了

安装过程自行百度。

使用brew安装openssl

备份openssl mv /usr/bin/openssl /usr/bin/openssl_old

复制cp -R /usr/local/Cellar/openssl/1.0.2r/bin/openssl /Users/zyc/Desktop/py/libevent-2.0.22-stable/include/openssl
解压 libevent-2.0.22-stable.tar.gz

创建快捷方式 ln -s /usr/local/Cellar/openssl/1.0.2r/include/openssl /Users/zyc/Desktop/py/libevent-2.0.22-stable/include/openssl
make &&  make install成功

再安装memcached-1.5.12

安装 pip3 install pylibmc

安装完成后,再次运行 pip3 install -r requirements/py3.txt,即运行成功


1.安装libevent时报错,需安装openssl
  CC       libevent_openssl_la-bufferevent_openssl.lo
bufferevent_openssl.c:66:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [libevent_openssl_la-bufferevent_openssl.lo] Error 1
make: *** [all] Error 2

2.去官网下载,或者brew install 
mopondys-iMac:openssl-master zyc$ openssl version
LibreSSL 2.6.4

mopondys-iMac:libevent-2.0.22-stable zyc$ brew install openssl

mopondys-iMac:libevent-2.0.22-stable zyc$ whereis openssl
/usr/bin/openssl
mopondys-iMac:libevent-2.0.22-stable zyc$ mv /usr/bin/openssl /usr/bin/openssl_old
mv: rename /usr/bin/openssl to /usr/bin/openssl_old: Operation not permitted
mopondys-iMac:libevent-2.0.22-stable zyc$ openssl version
LibreSSL 2.6.4
mopondys-iMac:libevent-2.0.22-stable zyc$ cp -R /usr/local/Cellar/openssl/1.0.2r/bin/openssl /Users/zyc/Desktop/py/libevent-2.0.22-stable/include/openssl


3. 
mopondys-iMac:memcached-1.5.12 zyc$ brew search gcc
==> Formulae
gcc             gcc@4.9         gcc@5           gcc@6           gcc@7           i386-elf-gcc

mopondys-iMac:memcached-1.5.12 zyc$ brew install gcc
==> Installing dependencies for gcc: gmp, isl, mpfr and libmpc


4.
mopondys-iMac:memcached-1.5.12 zyc$ brew install libmemcached
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes to formulae.

5.
mopondys-iMac:memcached-1.5.12 zyc$ pip3 install pylibmc
Collecting pylibmc
  Using cached https://files.pythonhosted.org/packages/f4/09/58b9621fc4e0433037b70f053e51a053406e75ec5f68522dcb887792bc1f/pylibmc-1.6.0.tar.gz
Installing collected packages: pylibmc
  Running setup.py install for pylibmc ... done
Successfully installed pylibmc-1.6.0

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值