python - 在 Ubuntu 上安装 Monary 0.4 时出错

标签 python mongodb ubuntu mongo-c-driver

我一直在尝试在运行 Ubuntu 14.04.1 LTS 的虚拟机上安装 Monary,但没有成功。 我已经安装了 Mongo C 驱动程序,我认为这已经正确完成。

对全文表示歉意。

[更新:启用 ssl 和 sasl 使用:

sudo apt-get install -y libsasl2-dev libssl-dev

然后

./configure --enable-ssl --enable-sas

]

使用

sudo pip install monary #or even without sudo

[现在] 给出:

Downloading/unpacking monary
  Downloading Monary-0.4.0.post2.tar.gz
  Running setup.py (path:/tmp/pip_build_root/monary/setup.py) egg_info for package monary

    warning: no previously-included files matching '*.py' found under directory 'test'
    warning: no previously-included files matching '*.py' found under directory 'timing'
Installing collected packages: monary
  Running setup.py install for monary
    building 'monary.libcmonary' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/include/python2.7 -c monary/cmonary.c -o build/temp.linux-x86_64-2.7/monary/cmonary.o -fPIC -O2 -DNDEBUG
    monary/cmonary.c: In function ‘monary_connect’:
    monary/cmonary.c:130:9: error: unknown type name ‘mongoc_ssl_opt_t’
             mongoc_ssl_opt_t opts = { pem_file, pem_pwd, ca_file, ca_dir, crl_file,
             ^
    monary/cmonary.c:130:9: warning: initialization makes integer from pointer without a cast [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]
    monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:132:9: warning: excess elements in scalar initializer [enabled by default]
             };
             ^
    monary/cmonary.c:132:9: warning: (near initialization for ‘opts’) [enabled by default]
    monary/cmonary.c:133:9: warning: implicit declaration of function ‘mongoc_client_set_ssl_opts’ [-Wimplicit-function-declaration]
             mongoc_client_set_ssl_opts(client, &opts);
             ^
    monary/cmonary.c: In function ‘monary_load_query’:
    monary/cmonary.c:1018:9: warning: variable ‘total_values’ set but not used [-Wunused-but-set-variable]
         int total_values;
             ^
    monary/cmonary.c: In function ‘monary_insert’:
    monary/cmonary.c:1374:11: warning: unused variable ‘str’ [-Wunused-variable]
         char *str;
               ^
    monary/cmonary.c:1368:25: warning: unused variable ‘citem’ [-Wunused-variable]
         monary_column_item *citem;
                             ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/monary/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-2kCMXO-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

creating build/lib.linux-x86_64-2.7/monary

copying monary/ordereddict.py -> build/lib.linux-x86_64-2.7/monary

copying monary/monary.py -> build/lib.linux-x86_64-2.7/monary

copying monary/monary_param.py -> build/lib.linux-x86_64-2.7/monary

copying monary/datehelper.py -> build/lib.linux-x86_64-2.7/monary

copying monary/__init__.py -> build/lib.linux-x86_64-2.7/monary

copying monary/write_concern.py -> build/lib.linux-x86_64-2.7/monary

running build_ext

building 'monary.libcmonary' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/monary

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/libbson-1.0 -I/usr/local/include/libmongoc-1.0 -I/usr/include/python2.7 -c monary/cmonary.c -o build/temp.linux-x86_64-2.7/monary/cmonary.o -fPIC -O2 -DNDEBUG

monary/cmonary.c: In function ‘monary_connect’:

monary/cmonary.c:130:9: error: unknown type name ‘mongoc_ssl_opt_t’

         mongoc_ssl_opt_t opts = { pem_file, pem_pwd, ca_file, ca_dir, crl_file,

         ^

monary/cmonary.c:130:9: warning: initialization makes integer from pointer without a cast [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:130:9: warning: excess elements in scalar initializer [enabled by default]

monary/cmonary.c:130:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:132:9: warning: excess elements in scalar initializer [enabled by default]

         };

         ^

monary/cmonary.c:132:9: warning: (near initialization for ‘opts’) [enabled by default]

monary/cmonary.c:133:9: warning: implicit declaration of function ‘mongoc_client_set_ssl_opts’ [-Wimplicit-function-declaration]

         mongoc_client_set_ssl_opts(client, &opts);

         ^

monary/cmonary.c: In function ‘monary_load_query’:

monary/cmonary.c:1018:9: warning: variable ‘total_values’ set but not used [-Wunused-but-set-variable]

     int total_values;

         ^

monary/cmonary.c: In function ‘monary_insert’:

monary/cmonary.c:1374:11: warning: unused variable ‘str’ [-Wunused-variable]

     char *str;

           ^

monary/cmonary.c:1368:25: warning: unused variable ‘citem’ [-Wunused-variable]

     monary_column_item *citem;

                         ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/monary/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-2kCMXO-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/monary
Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
    return command.main(cmd_args)
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 34: ordinal not in range(128)

我已经尝试重新安装/更新一些看似相关的软件包,但没有任何效果,而且我无法确定问题所在。

感谢任何帮助。谢谢!

最佳答案

我今天遇到了同样的问题。我通过引用此页面成功安装了 monary -0.5.0:

http://mongoc.org/libmongoc/current/installing.html (我的操作系统是 Ubuntu 16.04)

$ sudo apt-get install pkg-config libssl-dev libsasl2-dev
$ wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.2/mongo-c-driver-1.9.2.tar.gz
$ tar xzf mongo-c-driver-1.9.2.tar.gz
$ cd mongo-c-driver-1.9.2
$ ./configure --disable-automatic-init-and-cleanup
$ make
$ sudo make install
$ pip install pymongo monary  #install monary

关于python - 在 Ubuntu 上安装 Monary 0.4 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32468086/

相关文章:

python - 如何从嵌套列表中提取所有子列表?

angularjs - Node.js 从返回未定义的 MongoDB 获取请求

javascript - 无法通过 SSH 连接到 MySQL

bash - Docker 构建无法从 Dockerfile 中使用的 bash 脚本中的 archive.ubuntu.com 获取包

python - Pickle 可以处理大于我机器上安装的 RAM 的文件吗?

python - Tensorflow 变量未使用图间复制进行初始化

linux - 如何从 linux 命令行更改 MongoDB dbPath?

c# - MongoDB服务器状态已断开

node.js - 使用 NGINX 为 npm 注册表兑现包

python - 将 login_required 与 user_passes_test 组合时,Django 'User' 对象没有属性 'user'