{"id":6031,"date":"2019-12-28T10:21:33","date_gmt":"2019-12-28T01:21:33","guid":{"rendered":"http:\/\/blog.jansnap.com\/?p=6031"},"modified":"2021-12-17T23:15:10","modified_gmt":"2021-12-17T14:15:10","slug":"m2crypto%20%e3%82%92%20python3%e3%81%8b%e3%82%89%e4%bd%bf%e3%81%8a%e3%81%86%e3%81%a8%e3%80%8cpip%20install%20m2crypto%e3%80%8d%e3%81%97%e3%81%9f%e3%82%89%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%8c%e5%87%bae","status":"publish","type":"post","link":"https:\/\/blog.jansnap.com\/?p=6031","title":{"rendered":"M2Crypto \u3092 python3\u304b\u3089\u4f7f\u304a\u3046\u3068\u300cpip install M2Crypto\u300d\u3057\u305f\u3089\u30a8\u30e9\u30fc\u304c\u51fa\u305f"},"content":{"rendered":"\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E8%83%8C%E6%99%AF\"><\/span>\r\n    \u80cc\u666f<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>Ubuntu 18.04 \u306b M2Crypto\u3092\u5165\u308c\u3066python3\u304b\u3089\u4f7f\u304a\u3046\u3068\u3057\u305f\u3089\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5165\u3063\u3066\u3044\u306a\u304f\u3066\u30a8\u30e9\u30fc\u304c\u3067\u305f\u3002<\/li>\r\n    <li>\u74b0\u5883\r\n\r\n        <ul>\r\n            <li>Ubuntu 18.04.3 LTS<\/li>\r\n            <li>Python 3.6.9<\/li>\r\n            <li>(python2\u7cfb\u306f\u5165\u3063\u3066\u3044\u306a\u3044)<\/li>\r\n        <\/ul>\r\n    <\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E7%B5%90%E8%AB%96_%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E6%96%B9%E6%B3%95\"><\/span>\r\n    \u7d50\u8ad6: \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt-get install build-essential python3-dev openssl libssl-dev swig\r\n$ pip install M2Crypto<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u306e\u3088\u3046\u306b\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u3092apt-get\u3067\u5165\u308c\u3066\u304a\u3051\u3070\u554f\u984c\u306a\u3057\u3002<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"step_by_step_%E3%81%A7%E5%85%A5%E3%82%8C%E3%82%88%E3%81%86%E3%81%A8%E3%81%97%E3%81%9F%E6%99%82%E3%81%AE%E3%82%A8%E3%83%A9%E3%83%BC\"><\/span>\r\n    step by step \u3067\u5165\u308c\u3088\u3046\u3068\u3057\u305f\u6642\u306e\u30a8\u30e9\u30fc<span class=\"ez-toc-section-end\"><\/span><\/h2>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u30b0\u30b0\u3063\u3066\u3082\u30c9\u30f3\u30d4\u30b7\u30e3\u306e\u30da\u30fc\u30b8\u304c\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u30e1\u30e2\u3092\u6b8b\u3057\u3066\u304a\u304f\u3002<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>c++ (\u307e\u305f\u306fbuild-essential)\u304c\u5165\u3063\u3066\u3044\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"text\" class=\"language-text\">error: [Errno 2] No such file or directory: 'cpp': 'cpp'<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u3068\u51fa\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\u3089\u3001<br> $ sudo apt-get install cpp<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>gcc (\u307e\u305f\u306fbuild-essential)\u304c\u5165\u3063\u3066\u3044\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"text\" class=\"language-text\">    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory\r\n    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u3068\u51fa\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\u3089\u3001<br> $ sudo apt-get install gcc<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>python3-devel\u304c\u5165\u3063\u3066\u3044\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"text\" class=\"language-text\">    SWIG\/_m2crypto_wrap.c:127:10: fatal error: Python.h: No such file or directory\r\n        #include <python.h>\r\n                ^~~~~~~~~~\r\n    compilation terminated.\r\n    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1<\/python.h><\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u3068\u51fa\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\u3089\u3001<br> $ sudo apt-get install python3-dev<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>openssl, libssl-dev\u304c\u5165\u3063\u3066\u3044\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"text\" class=\"language-text\">    SWIG\/_m2crypto_wrap.c:3561:10: fatal error: openssl\/err.h: No such file or directory\r\n        #include <openssl err.h=\"\">\r\n                ^~~~~~~~~~~~~~~\r\n    compilation terminated.\r\n    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1<\/openssl><\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u3068\u51fa\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\u3089\u3001<br> $ sudo apt-get install openssl libssl-dev<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>swig\u304c\u5165\u3063\u3066\u3044\u306a\u3044<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<pre class=\"wp-block-code\"><code lang=\"text\" class=\"language-text\">    SWIG\/_m2crypto_wrap.c:31151:5: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]\r\n            (PyObject*) 0,                            \/* ht_slots *\/\r\n            ^\r\n    SWIG\/_m2crypto_wrap.c:31151:5: note: (near initialization for \u2018SwigPyBuiltin___cbd_t_type.as_buffer.bf_releasebuffer\u2019)\r\n    SWIG\/_m2crypto_wrap.c:30993:54: warning: missing braces around initializer [-Wmissing-braces]\r\n        static PyHeapTypeObject SwigPyBuiltin___cbd_t_type = {\r\n                                                            ^\r\n    SWIG\/_m2crypto_wrap.c:31150:5:\r\n            (PyObject*) 0,                            \/* ht_name *\/\r\n            {\r\n    SWIG\/_m2crypto_wrap.c:31152:1:\r\n        };\r\n        }\r\n    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1<\/code><\/pre>\r\n\r\n\r\n\r\n<p>\u3068\u51fa\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u306a\u304b\u3063\u305f\u3089\u3001<br> $ sudo apt-get install swig<br> (3.0.12-1\u304c\u5165\u3063\u305f)\r\n<\/p>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n    <li>\u3053\u306e\u5f8c\u3082\u7d9a\u304d\u305d\u3046\u3067\u3059\u304c\u3001\u4e0a\u8ff0\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306e\u3088\u3046\u306b\u666e\u901a\u306b\u5fc5\u8981\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u5165\u308c\u3066\u304b\u3089M2Crypto\u3092\u5165\u308c\u307e\u3057\u305f\u3002<\/li>\r\n<\/ul>\r\n","protected":false},"excerpt":{"rendered":"<p>Ubuntu 18.04 \u306b M2Crypto\u3092\u5165\u308c\u3066python3\u304b\u3089\u4f7f\u304a\u3046\u3068\u3057\u305f\u3089\u3001\u5fc5\u8981\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u5165\u3063\u3066\u3044\u306a\u304f\u3066\u30a8\u30e9\u30fc\u304c\u3067\u305f\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4177,4071],"tags":[4176,4066],"class_list":["post-6031","post","type-post","status-publish","format-standard","hentry","category-m2crypto","category-python3","tag-m2crypto","tag-python3"],"_links":{"self":[{"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/posts\/6031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6031"}],"version-history":[{"count":3,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/posts\/6031\/revisions"}],"predecessor-version":[{"id":6286,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=\/wp\/v2\/posts\/6031\/revisions\/6286"}],"wp:attachment":[{"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jansnap.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}