在macbook下安装pysqlite求教

PochaccoX 发布于 2017/03/01 17:54
阅读 264
收藏 0

我在mac ox 10.12下用pip install pysqlite,结果出现以下错误信息,请大牛帮我看看,多谢多谢!

Collecting pysqlite

  Using cached pysqlite-2.8.3.tar.gz

Installing collected packages: pysqlite

  Running setup.py install for pysqlite ... error

    Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-9Olkvn/pysqlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-f5iHel-record/install-record.txt --single-version-externally-managed --compile:

    running install

    running build

    running build_py

    creating build

    creating build/lib.macosx-10.12-intel-2.7

    creating build/lib.macosx-10.12-intel-2.7/pysqlite2

    copying lib/__init__.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2

    copying lib/dbapi2.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2

    copying lib/dump.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2

    creating build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/__init__.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/dbapi.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/dump.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/factory.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/hooks.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/regression.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/transactions.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/types.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    copying lib/test/userfunctions.py -> build/lib.macosx-10.12-intel-2.7/pysqlite2/test

    running build_ext

    building 'pysqlite2._sqlite' extension

    creating build/temp.macosx-10.12-intel-2.7

    creating build/temp.macosx-10.12-intel-2.7/src

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/module.c -o build/temp.macosx-10.12-intel-2.7/src/module.o

    In file included from src/module.c:277:

    src/sqlite_constants.h:764:19: warning: incompatible pointer to integer conversion initializing 'int' with an expression of type 'sqlite3_destructor_type' (aka 'void (*)(void *)') [-Wint-conversion]

    {"SQLITE_STATIC", SQLITE_STATIC},

                      ^~~~~~~~~~~~~

    /usr/include/sqlite3.h:4740:28: note: expanded from macro 'SQLITE_STATIC'

    #define SQLITE_STATIC      ((sqlite3_destructor_type)0)

                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

    In file included from src/module.c:277:

    src/sqlite_constants.h:767:22: warning: incompatible pointer to integer conversion initializing 'int' with an expression of type 'sqlite3_destructor_type' (aka 'void (*)(void *)') [-Wint-conversion]

    {"SQLITE_TRANSIENT", SQLITE_TRANSIENT},

                         ^~~~~~~~~~~~~~~~

    /usr/include/sqlite3.h:4741:28: note: expanded from macro 'SQLITE_TRANSIENT'

    #define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    2 warnings generated.

    In file included from src/module.c:277:

    src/sqlite_constants.h:764:19: warning: incompatible pointer to integer conversion initializing 'int' with an expression of type 'sqlite3_destructor_type' (aka 'void (*)(void *)') [-Wint-conversion]

    {"SQLITE_STATIC", SQLITE_STATIC},

                      ^~~~~~~~~~~~~

    /usr/include/sqlite3.h:4740:28: note: expanded from macro 'SQLITE_STATIC'

    #define SQLITE_STATIC      ((sqlite3_destructor_type)0)

                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

    In file included from src/module.c:277:

    src/sqlite_constants.h:767:22: warning: incompatible pointer to integer conversion initializing 'int' with an expression of type 'sqlite3_destructor_type' (aka 'void (*)(void *)') [-Wint-conversion]

    {"SQLITE_TRANSIENT", SQLITE_TRANSIENT},

                         ^~~~~~~~~~~~~~~~

    /usr/include/sqlite3.h:4741:28: note: expanded from macro 'SQLITE_TRANSIENT'

    #define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    2 warnings generated.

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/connection.c -o build/temp.macosx-10.12-intel-2.7/src/connection.o

    src/connection.c:514:46: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

            sqlite3_result_blob(context, buffer, buflen, SQLITE_TRANSIENT);

            ~~~~~~~~~~~~~~~~~~~                  ^~~~~~

    1 warning generated.

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/cursor.c -o build/temp.macosx-10.12-intel-2.7/src/cursor.o

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/cache.c -o build/temp.macosx-10.12-intel-2.7/src/cache.o

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/microprotocols.c -o build/temp.macosx-10.12-intel-2.7/src/microprotocols.o

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/prepare_protocol.c -o build/temp.macosx-10.12-intel-2.7/src/prepare_protocol.o

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/statement.c -o build/temp.macosx-10.12-intel-2.7/src/statement.o

    src/statement.c:194:59: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                rc = sqlite3_bind_text(self->st, pos, string, buflen, SQLITE_TRANSIENT);

                     ~~~~~~~~~~~~~~~~~                        ^~~~~~

    src/statement.c:199:59: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                rc = sqlite3_bind_text(self->st, pos, string, buflen, SQLITE_TRANSIENT);

                     ~~~~~~~~~~~~~~~~~                        ^~~~~~

    src/statement.c:204:63: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                    rc = sqlite3_bind_blob(self->st, pos, buffer, buflen, SQLITE_TRANSIENT);

                         ~~~~~~~~~~~~~~~~~                        ^~~~~~

    src/statement.c:264:26: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                num_params = PyTuple_GET_SIZE(parameters);

                           ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/tupleobject.h:51:33: note: expanded from macro 'PyTuple_GET_SIZE'

    #define PyTuple_GET_SIZE(op)    Py_SIZE(op)

                                    ^~~~~~~~~~~

    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'

    #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)

                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

    src/statement.c:266:26: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                num_params = PyList_GET_SIZE(parameters);

                           ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/listobject.h:63:32: note: expanded from macro 'PyList_GET_SIZE'

    #define PyList_GET_SIZE(op)    Py_SIZE(op)

                                   ^~~~~~~~~~~

    /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'

    #define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)

                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~

    src/statement.c:268:26: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

                num_params = PySequence_Size(parameters);

                           ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~

    6 warnings generated.

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/util.c -o build/temp.macosx-10.12-intel-2.7/src/util.o

    src/util.c:135:27: warning: implicit conversion loses integer precision: 'sqlite_int64' (aka 'long long') to 'long' [-Wshorten-64-to-32]

        return PyInt_FromLong(value);

               ~~~~~~~~~~~~~~ ^~~~~

    1 warning generated.

    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DMODULE_NAME="pysqlite2.dbapi2" -Ish: -Ipkg-config: -Icommand -Inot -Ifound -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/row.c -o build/temp.macosx-10.12-intel-2.7/src/row.o

    src/row.c:110:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

            nitems = PyTuple_Size(self->description);

                   ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    src/row.c:168:14: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]

        nitems = PyTuple_Size(self->description);

               ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    2 warnings generated.

    cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/src/module.o build/temp.macosx-10.12-intel-2.7/src/connection.o build/temp.macosx-10.12-intel-2.7/src/cursor.o build/temp.macosx-10.12-intel-2.7/src/cache.o build/temp.macosx-10.12-intel-2.7/src/microprotocols.o build/temp.macosx-10.12-intel-2.7/src/prepare_protocol.o build/temp.macosx-10.12-intel-2.7/src/statement.o build/temp.macosx-10.12-intel-2.7/src/util.o build/temp.macosx-10.12-intel-2.7/src/row.o -Lsh: -Lpkg-config: -Lcommand -Lnot -Lfound -lsqlite3 -o build/lib.macosx-10.12-intel-2.7/pysqlite2/_sqlite.so

    ld: warning: directory not found for option '-Lsh:'

    ld: warning: directory not found for option '-Lpkg-config:'

    ld: warning: directory not found for option '-Lcommand'

    ld: warning: directory not found for option '-Lnot'

    ld: warning: directory not found for option '-Lfound'

    ld: warning: directory not found for option '-Lsh:'

    ld: warning: directory not found for option '-Lpkg-config:'

    ld: warning: directory not found for option '-Lcommand'

    ld: warning: directory not found for option '-Lnot'

    ld: warning: directory not found for option '-Lfound'

    running install_lib

    copying build/lib.macosx-10.12-intel-2.7/pysqlite2/_sqlite.so -> /Library/Python/2.7/site-packages/pysqlite2

    running install_data

    creating /System/Library/Frameworks/Python.framework/Versions/2.7/pysqlite2-doc

    error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/pysqlite2-doc': Operation not permitted

    

    ----------------------------------------

Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-9Olkvn/pysqlite/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-f5iHel-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-9Olkvn/pysqlite/

加载中
0
mickelfeng
mickelfeng

sudo pip install pysqlite

PochaccoX
PochaccoX
回复@mickelfeng : 谢谢你的回复,在此之前我已经加了,而且SQLite3也装了
0
quanwei9958
quanwei9958

给pip加上root权限试试

PochaccoX
PochaccoX
回复@quanwei9958 : 谢谢你的回复,在此之前我已经加了,而且SQLite3也装了
0
PochaccoX
PochaccoX

自己找到了答案,在http://xiaorui.cc/2016/03/27/解决mac-osx下pip安装ipython权限的问题/ 中提到

权限问题… OSError: [Errno 1] Operation not permitted ,   各种的root都不可以,想到了一个粗暴的方式,直接针对share进行chmod的授权。  结果… 提示root也是没有权限操作系统的目录。   我突然发觉肯定是新版的osx有了某种机制制止我们直接的修改/System文档数据。 

google了后,发现果然如我的所料….  新系统有个叫sip的机制。 你暂时不能直接在终端进行 csrutil disable 会出现错误提示,引导你去mac osx的恢复模式进行操作。 

由于El Capitan引入了SIP机制(System Integrity Protection),默认下系统启用SIP系统完整性保护机制,无论是对于硬盘还是运行时的进程限制对系统目录的写操作。 这也是我们安装ipython失败的原因….

 用 sudo pip install pysqlite --user -U 安装即可

返回顶部
顶部