我正在尝试在Mac OSX 10.6.8上启动couchbase并运行python。我按照这里的说明进行操作:
http://docs.couchbase.com/couchbase-sdk-python-1.2/index.html#getting-started
但我坚持第2步:
下载并安装C库。
根据此处安装C SDK的说明:
http://docs.couchbase.com/developer/c-2.4/download-install.html
我这样做了:
~$ brew update
....
....
~$ brew install libcouchbase
但是当自制软件尝试安装依赖项cmake
时,我收到错误:
==> Installing libcouchbase dependency: cmake
==> Downloading http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake-3.1.0.tar.gz
==> Patching
==> Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.2.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--sphinx-1.2.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--markupsafe-0.23.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--docutils-0.12.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--pygments-2.0.1.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--jinja2-2.7.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-HcEaFf/cmake-3.1.0/sphinx --single-version-e
==> ./bootstrap --prefix=/Users/7stud/.homebrew/Cellar/cmake/3.1.0 --system-libs --parallel=2 --no-system-libarchiv
==> make
[ 34%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/archive_write_set_options.c.o
[ 34%] Building C object Utilities/cmlibarchive/libarchive/CMakeFiles/cmlibarchive.dir/filter_fork_posix.c.o
Linking C static library libcmlibarchive.a
[ 34%] Built target cmlibarchive
make: *** [all] Error 2
READ THIS: http://git.io/brew-troubleshooting
These open issues may also help:
Fix LLVM CMake modules not being preprocessed (https://github.com/Homebrew/homebrew/pull/29976)
cmake builds fail on CLT-only with --env=std (https://github.com/Homebrew/homebrew/issues/29101)
这里有更多细节:
~$ brew gist-logs --config --doctor cmake
https://gist.github.com/a37987f168d284128cfe
任何人对我该做什么都有任何想法?感谢。
答案 0 :(得分:1)
您是否拥有Xcode及其devtools的最新版本(适用于10.6.8版本)?这似乎是GCC的一个问题(我最初在使用Xcode的LLVM gcc版Apple套件时遇到了问题)。
尝试brew install gcc
(或brew reinstall gcc
如果您最初使用brew来安装gcc),然后再次运行brew install make
。
答案 1 :(得分:0)
我安装了XCode版本3.2.6,我相信这是与OSX 10.6.8兼容的最高版本。
在我发布的链接中,其中一个错误是:
error: ncurses/ncurses.h: No such file or directory
我在我的系统上找到了ncurses.h:
/usr/include$ ls -al ncurses.h
lrwxr-xr-x 1 root wheel 8 Aug 11 2012 ncurses.h -> curses.h
...如果你注意到它不在名为ncurses的目录中(查看提示符) - ncurses是ncurses.h应该出现的错误消息的目录。另请注意,ncurses.h是指向另一个文件的链接:curses.h(请参阅右侧的箭头?)。所以,我这样做了:
/usr/include$ sudo mkdir ncurses
Password:
/usr/include$ cd ncurses
/usr/include/ncurses$ sudo cp -av ../ncurses.h . (-a => copy link rather than the file it points to, -v => verbose, show what is being copied)
Password:
../ncurses.h -> ./ncurses.h
/usr/include/ncurses$ ls -al
total 8
drwxr-xr-x 3 root wheel 102 Dec 29 18:59 .
drwxr-xr-x 272 root wheel 9248 Dec 29 18:13 ..
lrwxr-xr-x 1 root wheel 8 Dec 29 18:59 ncurses.h -> curses.h
然后我再次尝试安装libcouchbase:
~$ brew install libcouchbase
==> Installing libcouchbase dependency: cmake
==> Downloading http://www.cmake.org/files/v3.1/cmake-3.1.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake-3.1.0.tar.gz
==> Patching
==> Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--jinja2-2.7.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.ta
Already downloaded: /Library/Caches/Homebrew/cmake--markupsafe-0.23.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--docutils-0.12.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.1.tar.g
Already downloaded: /Library/Caches/Homebrew/cmake--pygments-2.0.1.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.2.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake--sphinx-1.2.3.tar.gz
==> python -c import setuptools... install --prefix=/private/tmp/cmake-FqXEf3/cmake-3.1
==> ./bootstrap --prefix=/Users/7stud/.homebrew/Cellar/cmake/3.1.0 --system-libs --para
==> make
==> make install
/Users/7stud/.homebrew/Cellar/cmake/3.1.0: 1819 files, 33M, built in 18.5 minutes
==> Installing libcouchbase
==> Downloading http://packages.couchbase.com/clients/c/libcouchbase-2.4.5_1_gd7f6ecf.t
######################################################################## 100.0%
==> Patching
==> cmake .. -DCMAKE_INSTALL_PREFIX=/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_
==> make install
/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf: 53 files, 1.4M, built in 42 seconds
$
我不相信,所以我再次尝试:
~$ brew install libcouchbase
Warning: libcouchbase-2.4.5_1_gd7f6ecf already installed
~$ brew uninstall libcouchbase
Uninstalling /Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf...
~$ brew install libcouchbase
==> Downloading http://packages.couchbase.com/clients/c/libcouchbase-2.4.5_1_gd7f6ecf.t
Already downloaded: /Library/Caches/Homebrew/libcouchbase-2.4.5_1_gd7f6ecf.tar.gz
==> Patching
==> cmake .. -DCMAKE_INSTALL_PREFIX=/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_
==> make install
/Users/7stud/.homebrew/Cellar/libcouchbase/2.4.5_1_gd7f6ecf: 53 files, 1.4M, built in 30 seconds
~$
测试安装:
/usr/include/ncurses$ cbc version
cbc:
Runtime: Version=2.4.5_1_gd7f6ecf, Changeset=d7f6ecfa15e73c668a8f81947d9f85b654dcdbda
Headers: Version=2.4.5_1_gd7f6ecf, Changeset=d7f6ecfa15e73c668a8f81947d9f85b654dcdbda
IO: Default=libevent, Current=libevent
SSL: .. SUPPORTED
但后来我无法按照此处的说明安装Python SDK:
http://docs.couchbase.com/couchbase-sdk-python-1.2/
$ python -V
Python 2.7.9
我到了这里:
5. Install the Python SDK. The easiest way to do this is via the pip tool:
shell> pip install couchbase --quiet
但这就是发生的事情:
$ pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c"导入setuptools; 文件 =' / private / var / folders / ++ / ++ iEr0qoGaimgUBsnNcijk +++ TI / -Tmp- / pip_build_7stud / couchbase / setup。 PY&#39 ;; EXEC(编译(开放(的文件)读()代替(' \ r \ n&#39 ;, ' \ n'),档案,' exec'))"安装 - 记录 /var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI--Tmp-/pip-eflT9C-record/install-record.txt --single-version-external-managed失败,错误代码为1 / private / var /文件夹/ ++ / ++ +++ iEr0qoGaimgUBsnNcijk TI / -Tmp- / pip_build_7stud / couchbase Traceback(最近一次调用最后一次):文件 " /Library/Frameworks/Python.framework/Versions/2.7/bin/pip" ;,第9行, 在 load_entry_point(' pip == 1.4.1',' console_scripts',' pip')()文件" /Library/Frameworks/Python.framework/版本/ 2.7 / LIB / python2.7 /站点包/ PIP-1.4.1-py2.7.egg / PIP /的初始化强>的.py&#34 ;, 第148行,主要 return command.main(args [1:],options)File" /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7 .egg / PIP / basecommand.py&#34 ;, 第169行,主要 text =' \ n' .join(complete_log)UnicodeDecodeError:' ascii'编解码器不能解码位置63中的字节0xe2:序数不在范围内(128)
同样的事情:
$ LC_ALL = C pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c"导入setuptools; 文件 =' / private / var / folders / ++ / ++ iEr0qoGaimgUBsnNcijk +++ TI / -Tmp- / pip_build_7stud / couchbase / setup。 PY&#39 ;; EXEC(编译(开放(的文件)读()代替(' \ r \ n&#39 ;, ' \ n'),档案,' exec'))"安装 - 记录 /var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI--Tmp-/pip-Oe6ydu-record/install-record.txt --single-version-external-managed失败,错误代码为1 / private / var /文件夹/ ++ / ++ +++ iEr0qoGaimgUBsnNcijk TI / -Tmp- / pip_build_7stud / couchbase 存储完整的日志/Users/7stud/.pip/pip.log / usr / include / ncurses $ pip install couchbase --quiet命令 /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c"导入setuptools; 文件 =' / private / var / folders / ++ / ++ iEr0qoGaimgUBsnNcijk +++ TI / -Tmp- / pip_build_7stud / couchbase / setup。 PY&#39 ;; EXEC(编译(开放(的文件)读()代替(' \ r \ n&#39 ;, ' \ n'),档案,' exec'))"安装 - 记录 /var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI--Tmp-/pip-GijsbQ-record/install-record.txt --single-version-external-managed失败,错误代码为1 / private / var /文件夹/ ++ / ++ +++ iEr0qoGaimgUBsnNcijk TI / -Tmp- / pip_build_7stud / couchbase Traceback(最近一次调用最后一次):文件 " /Library/Frameworks/Python.framework/Versions/2.7/bin/pip" ;,第9行, 在 load_entry_point(' pip == 1.4.1',' console_scripts',' pip')()文件" /Library/Frameworks/Python.framework/版本/ 2.7 / LIB / python2.7 /站点包/ PIP-1.4.1-py2.7.egg / PIP /的初始化强>的.py&#34 ;, 第148行,主要 return command.main(args [1:],options)File" /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.4.1-py2.7 .egg / PIP / basecommand.py&#34 ;, 第169行,主要 text =' \ n' .join(complete_log)UnicodeDecodeError:' ascii'编解码器不能解码位置63中的字节0xe2:序数不在范围内(128)
我通过修补python源代码修复了unicode错误:
#text = '\n'.join(complete_log)
#python 2.x patch found here: https://github.com/pypa/pip/issues/1137
text = '\n'.join(to_utf8(l) for l in complete_log)
但后来我收到了这个错误:
$ pip install couchbase --quiet
Command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c"导入setuptools; 文件 =' / private / var / folders / ++ / ++ iEr0qoGaimgUBsnNcijk +++ TI / -Tmp- / pip_build_7stud / couchbase / setup。 PY&#39 ;; EXEC(编译(开放(的文件)读()代替(' \ r \ n&#39 ;, ' \ n'),档案,' exec'))"安装 - 记录 /var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI--Tmp-/pip-AQtdf2-record/install-record.txt --single-version-external-managed失败,错误代码为1 / private / var /文件夹/ ++ / ++ +++ iEr0qoGaimgUBsnNcijk TI / -Tmp- / pip_build_7stud / couchbase 存储完整的登录/Users/7stud/.pip/pip.log
$
(我刚看了上面提到的错误日志:pip.log,它说错误是一个KeyboardInterrupt。嗯?所以,我再次尝试了$ pip install couchbase --quiet
并且它运行了。然后,测试安装{ {1}},并没有错误!我不知道我在下面做的事情是否影响了任何事情。)
接下来,我决定尝试从源代码安装:
根据自述文件:
$ python -c 'import couchbase'
但结尾是这样的:
src / exceptions.c:136:错误:函数的参数太多 'pycbc_exc_map'lipo:无法找出以下架构类型: /var/folders/++/++iEr0qoGaimgUBsnNcijk+++TI--Tmp-//ccZekvJj.out错误: 命令' gcc-4.2'退出状态1失败
接下来,我这样做了:
〜/ Downloads / couchbase-1.2.4 $ python setup.py build_ext \
> --library-dir~ / .homebrew / Cellar / libcouchbase / 2.4.5_1_gd7f6ecf / lib \
> --include-dir~ / .homebrew / Cellar / libcouchbase / 2.4.5_1_gd7f6ecf / include运行build_ext building' couchbase._libcouchbase'扩展gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot
...
...
Intel的2.7 / SRC / iops.o 建立/ temp.macosx-10.6-Intel的2.7 / SRC / connevents.o 建立/ temp.macosx-10.6-Intel的2.7 / SRC / pipeline.o 建立/ temp.macosx-10.6-Intel的2.7 / SRC / viewrow / viewrow.o 建立/ temp.macosx-10.6-Intel的2.7 / SRC /了contrib / jsonsl / jsonsl.o -L / Users / 7stud / .homebrew / Cellar / libcouchbase / 2.4.5_1_gd7f6ecf / lib -lcouchbase -o build / lib.macosx-10.6-intel-2.7 / couchbase / _libcouchbase.so
...结果没有错误。但是测试安装失败了:
~/Downloads/couchbase-1.2.4$ python setup.py build_ext --inplace
所以,我想到了什么,我会继续尝试这个:
~/Downloads/couchbase-1.2.4$ python -c 'import couchbase'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "couchbase/__init__.py", line 18, in <module>
from couchbase.connection import Connection
File "couchbase/connection.py", line 22, in <module>
import couchbase._bootstrap
File "couchbase/_bootstrap.py", line 34, in <module>
import couchbase.exceptions as E
File "couchbase/exceptions.py", line 18, in <module>
import couchbase._libcouchbase as C
ImportError: No module named _libcouchbase
但是,我在测试安装时遇到了相同的导入错误,所以我放弃了。
在阅读了我的问题的答案之后,我做了:
~/Downloads/couchbase-1.2.4$ python setup.py install
...
...
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/couchbase-1.2.4-py2.7-macosx-10.6-intel.egg
Processing dependencies for couchbase==1.2.4
Finished processing dependencies for couchbase==1.2.4
但直到现在我还没有尝试修复couchbase。我不认为用自制软件安装gcc做了什么,因为我仍然得到:
〜$ gcc --version
i686-apple-darwin10-gcc-4.2.1(GCC)4.2.1(Apple Inc. build 5666)(第3点)版权所有(C)2007 Free Software Foundation,Inc。 这是免费软件;查看复制条件的来源。那里 不保修;甚至不适用于A的适销性或适用性 特殊用途。/ usr / bin $ gcc
/ usr / bin / gcc/ usr / bin $ ls -al / usr / bin / gcc
lrwxr-xr-x 1根轮2012年8月11日/ usr / bin / gcc - &gt; GCC-4.2
...这是gcc的Apple版本。但是,当我用自制软件安装gcc时,我得到了输出:
/Users/7stud/.homebrew/Cellar/gcc/4.9.2_1:1155个文件,200M,内置 106.8分钟
...这是gcc版本4.9。