小编shi*_*ivg的帖子

python pycrypto安装错误

可能重复:
未找到PyCrypto和GMP库错误[Mac OS 10.6.3]

我正在尝试在ubuntu上安装pycrypto,但它会抛出错误

hom@PC71:~/Desktop/pycrypto-2.3$ sudo python setup.py build
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.6 -c src/MD2.c -o build/temp.linux-i686-2.6/src/MD2.o
src/MD2.c:31: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

我已经安装了python-dev工具.

python pycrypto

12
推荐指数
1
解决办法
3万
查看次数

Python的两个字典列表的交集

我有2个像dic的列表

list1 = [{'count': 351, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 332, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 336, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 359, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 309, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'}]


list2 = [{'count': 359, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 351, 'evt_datetime': datetime.datetime(2015, 10, 23, 8, 45), 'att_value': 'red'},
     {'count': 381, 'evt_datetime': datetime.datetime(2015, 10, …
Run Code Online (Sandbox Code Playgroud)

python python-3.4

3
推荐指数
1
解决办法
829
查看次数

弹性搜索查询/过滤嵌套数组

我在ES中的索引test_agg上存储了以下嵌套数据类型。

{
  "Date": "2015-10-21",
  "Domain": "abc.com",
  "Processed_at": "10/23/2015 9:47",
  "Events": [
    {
      "Name": "visit",
      "Count": "188",
      "Value_Aggregations": [
        {
          "Value": "red",
          "Count": "100"
        }
      ]
    },
    {
      "Name": "order_created",
      "Count": "159",
      "Value_Aggregations": [
        {
          "Value": "$125",
          "Count": "50"
        }
      ]
   },
 ]
}
Run Code Online (Sandbox Code Playgroud)

嵌套项的映射为

curl -XPOST localhost:9200/test_agg/nested_evt/_mapping -d '{
"nested_evt":{
"properties":{
   "Events": {
       "type": "nested"
    }
   }
  }
}'
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下查询获取“ Events.Count”和“ Events.Value_Aggregations.Count”,其中Events.Name =“ Visit”

{
 "fields" : ["Events.Count","Events.Value_Aggregations.Count"]
  "query": {
     "filtered": {
        "query": {
            "match": { "Domain": "abc.com" }
        }, …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

0
推荐指数
1
解决办法
2999
查看次数

标签 统计

python ×2

elasticsearch ×1

pycrypto ×1

python-3.4 ×1