{"id":12313,"date":"2017-09-04T11:09:44","date_gmt":"2017-09-04T02:09:44","guid":{"rendered":"http:\/\/sitest.jp\/blog\/?p=12313"},"modified":"2017-09-04T11:09:44","modified_gmt":"2017-09-04T02:09:44","slug":"%e3%80%90%e5%88%9d%e5%bf%83%e8%80%85%e5%90%91%e3%81%91%e3%80%91-python-%e3%81%ae%e4%bb%ae%e6%83%b3%e7%92%b0%e5%a2%83%e6%a7%8b%e7%af%89%e3%81%af%e3%81%93%e3%82%8c%e3%81%a7%e3%81%8d%e3%81%be%e3%82%8a","status":"publish","type":"post","link":"https:\/\/sitest.jp\/blog\/?p=12313","title":{"rendered":"\u3010\u521d\u5fc3\u8005\u5411\u3051\u3011 Python  \u306e\u4eee\u60f3\u74b0\u5883\u69cb\u7bc9\u306f\u3053\u308c\u3067\u304d\u307e\u308a\uff01 pyenv-virtualenv \u3092\u4f7f\u3063\u3066\u307f\u3088\u3046"},"content":{"rendered":"<p>Python \u306e\u4eee\u60f3\u74b0\u5883\u306f\u4f7f\u3063\u3066\u307e\u3059\u304b\uff1f<br \/>\nPython \u59cb\u3081\u305f\u3070\u304b\u308a\u306e\u521d\u5fc3\u8005\u3067\u4eee\u60f3\u74b0\u5883\u3092\u4f7f\u3063\u3066\u306a\u3044\u4eba\u3082\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u305d\u3093\u306a Python \u521d\u5fc3\u8005\u306e\u305f\u3081\u306b\u4eee\u60f3\u74b0\u5883\u306e\u6982\u8981\u304b\u3089 <a href=\"https:\/\/github.com\/pyenv\/pyenv-virtualenv\" target=\"_blank\" rel=\"nofollow\">pyenv-virtualenv<\/a> \u306e\u4f7f\u3044\u65b9\u307e\u3067\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>\u203b Mac \u30e6\u30fc\u30b6\u30fc\u5411\u3051\u306e\u8a18\u4e8b\u3067\u3059\u3002<br \/>\n<!--more--><\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u305d\u3082\u305d\u3082\u4eee\u60f3\u74b0\u5883\u306f\u5fc5\u8981\u306a\u306e\uff1f<\/h3>\n<\/div>\n<p>Python \u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u30c6\u30b9\u30c8\u3057\u305f\u3044\u3068\u304d\u304c\u3042\u308b\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n\u304a\u4f7f\u3044\u306e Python \u74b0\u5883\u3067\u3082\u4f7f\u3048\u308b\u3068\u306f\u601d\u3046\u306e\u3067\u3059\u304c\u3001\u305d\u308c\u3060\u3068\u4ed5\u69d8\u4e0a\u3001<br \/>\n\u5404\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u30b0\u30ed\u30fc\u30d0\u30eb\u306e\u540c\u3058\u7b87\u6240\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u6c5a\u308c\u3066\u3057\u307e\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u3088\u3046\u306a\u6642\u306b\u4f7f\u3048\u308b\u306e\u304c\u4eee\u60f3\u74b0\u5883\u3067\u3059\u3002<br \/>\n\u4eee\u60f3\u74b0\u5883\u304c\u3042\u308b\u3068\u3001\u74b0\u5883\u304c\u6c5a\u308c\u308b\u3053\u3068\u3092\u304a\u69cb\u3044\u306a\u3057\u306b\u30c6\u30b9\u30c8\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">pyenv-virtualenv \u3063\u3066\u4f55\uff1f<\/h3>\n<\/div>\n<p><img loading=\"lazy\" src=\"https:\/\/storage.googleapis.com\/sitest-wp\/blog\/wp-content\/uploads\/2017\/08\/the-pudge.png\" alt=\"pyenv-virtualenv\" width=\"500\" height=\"500\" class=\"size-full wp-image-12314\" \/><br \/>\n\u4eee\u60f3\u74b0\u5883\u306e\u69cb\u7bc9\u3059\u308b\u30c4\u30fc\u30eb\u3068\u3057\u3066\u3001 pyenv \u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\npyenv \u306f\u4fbf\u5229\u3067 Python \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u6bce\u306b\u4eee\u60f3\u74b0\u5883\u3092\u308f\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u6bce\u3067\u306f\u306a\u3044\u306e\u3067\u3001 \u540c\u30d0\u30fc\u30b8\u30e7\u30f3\u306e Python \u3067\u8907\u6570\u306e\u30c6\u30b9\u30c8\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u3001\u5225\u306b\u308f\u3051\u308b\u5fc5\u8981\u304c\u3067\u3066\u304d\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u554f\u984c\u3092\u89e3\u6c7a\u3057\u3066\u304f\u308c\u308b\u306e\u304c\u3001 pyenv \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e pyenv-virtualenv \u3067\u3059\u3002<br \/>\npyenv-virtualenv \u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3054\u3068\u306b\u4eee\u60f3\u74b0\u5883\u3092\u305f\u3066\u3066\u304f\u308c\u308b\u305f\u3081\u3001\u540c\u30d0\u30fc\u30b8\u30e7\u30f3\u306e Python \u3067\u8907\u6570\u306e\u30c6\u30b9\u30c8\u3092\u5b89\u6613\u306b\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3061\u306a\u307f\u306b\u3067\u3059\u304c\u3001 virtualenv \u3068\u3044\u3046\u3082\u306e\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u3061\u3089\u306f\u5225\u7269\u3067\u3059\u3002<\/p>\n<p>\u3053\u3053\u304b\u3089\u306f\u5b9f\u969b\u306b\u4f7f\u3063\u3066\u307f\u3066\u3001\u899a\u3048\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">pyenv-virtualenv \u3092\u4f7f\u3063\u3066\u3044\u3053\u3046<\/h3>\n<\/div>\n<p>\u307e\u305a\u3001Homebrew \u3092\u4f7f\u7528\u3057\u3066\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code>brew install pyenv\nbrew install pyenv-virtualenv\n<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001 vim \u3067 .bash_profile \u3092\u958b\u304f\u3002<\/p>\n<pre><code>vim ~\/.bash_profile\n<\/code><\/pre>\n<p>\u4e0b\u8a18\u306e\u8a18\u8ff0\u3092\u8ffd\u8a18\u3057\u307e\u3059\u3002<\/p>\n<pre><code>[.bash_profile]\n\n# pyenv\u306epath\u3092\u8a2d\u5b9a\nexport PYENV_ROOT=\"${HOME}\/.pyenv\"\nif [ -d \"${PYENV_ROOT}\" ]; then\n    export PATH=${PYENV_ROOT}\/bin:$PATH\n    eval \"$(pyenv init -)\"\n    eval \"$(pyenv virtualenv-init -)\"\nfi\n<\/code><\/pre>\n<p>.bash_profile \u306e\u5909\u66f4\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre><code>source ~\/.bash_profile\n<\/code><\/pre>\n<p>\u305d\u308c\u3067\u306f\u3001\u4eee\u60f3\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u308b\u30c4\u30fc\u30eb\u3068\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u8868\u793a\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<pre><code>pyenv install --list\n<\/code><\/pre>\n<p>\u30ea\u30b9\u30c8\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u306d\u3002<br \/>\n\u4eca\u56de\u306f 2.7.10 \u306e\u74b0\u5883\u3092\u4f5c\u308a\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre><code>pyenv install 2.7.10\n<\/code><\/pre>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u306f Python \u30d0\u30fc\u30b8\u30e7\u30f3\u7fa4\u306b\u57fa\u3065\u3044\u3066\u518d\u69cb\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001\u4e0b\u8a18\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre><code>pyenv rehash\n<\/code><\/pre>\n<p>\u6b21\u306b\u4eee\u60f3\u74b0\u5883\u3092\u8b58\u5225\u3059\u308b\u30bf\u30b0\u3092\u3064\u3051\u307e\u3059\u3002<\/p>\n<pre><code>pyenv virtualenv 2.7.10 local_python_tag\n<\/code><\/pre>\n<p>\u4f5c\u6210\u3057\u305f\u4eee\u60f3\u74b0\u5883\u306f\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code>pyenv versions\n<\/code><\/pre>\n<p>\u5148\u7a0b\u3001\u4f5c\u6210\u3057\u305f local_python_tag \u304c\u4f5c\u3089\u308c\u3066\u3044\u307e\u3059\u306d\u3002<br \/>\n\u6b21\u306b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u9032\u3081\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code>mkdir local_python_dir\ncd .\/local_python_dir\n<\/code><\/pre>\n<p>local_python_dir \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067\u4f5c\u696d\u3057\u3066\u3044\u304f\u3053\u3068\u306b\u3057\u307e\u3059\u3002<br \/>\n\u305d\u308c\u3067\u306f\u4ed5\u4e0a\u3052\u3067\u3059\u3002<\/p>\n<pre><code>pyenv local local_python_tag\n<\/code><\/pre>\n<p>Python \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n2.7.10 \u306b\u5207\u308a\u66ff\u308f\u3063\u3066\u3044\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u3001local_python_dir \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c Python2.7.10 \u306e\u4eee\u60f3\u74b0\u5883\u304c\u5b8c\u6210\u3057\u307e\u3057\u305f\u3002<br \/>\nlocal_python_dir \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u6c5a\u3057\u3066\u69cb\u3044\u307e\u305b\u3093\u3057\u3001\u540c\u624b\u9806\u3067\u9055\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"frame_headding\">\n<h3 style=\"text-align: left;\">\u307e\u3068\u3081<\/h3>\n<\/div>\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>\u4eca\u56de\u306f\u3001\u4eee\u60f3\u74b0\u5883\u306e\u6982\u8981\u304b\u3089 pyenv-virtualenv \u306e\u4f7f\u3044\u65b9\u307e\u3067\u3092\u8aac\u660e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>pyenv \u3067\u30b0\u30ed\u30fc\u30d0\u30eb\u306e Python \u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5207\u308a\u66ff\u3048\u3066\u3001 pyenv-virtualenv \u3067\u30ed\u30fc\u30ab\u30eb\u306e\u4eee\u60f3\u74b0\u5883\u3092\u7acb\u3061\u4e0a\u3052\u308b\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3048\u3070\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u30c6\u30b9\u30c8\u3082\u5e72\u6e09\u306a\u304f\u7c21\u5358\u306b\u884c\u306a\u3048\u307e\u3059\u306e\u3067\u3001\u662f\u975e\u3001\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python \u306e\u4eee\u60f3\u74b0\u5883\u306f\u4f7f\u3063\u3066\u307e\u3059\u304b\uff1f Python \u59cb\u3081\u305f\u3070\u304b\u308a\u306e\u521d\u5fc3\u8005\u3067\u4eee\u60f3\u74b0\u5883\u3092\u4f7f\u3063\u3066\u306a\u3044\u4eba\u3082\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002 \u4eca\u56de\u306f\u305d\u3093\u306a Python \u521d\u5fc3\u8005\u306e\u305f\u3081\u306b\u4eee\u60f3\u74b0\u5883\u306e\u6982\u8981\u304b\u3089 pyenv-virtualenv \u306e\u4f7f\u3044\u65b9\u307e\u3067\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002 \u203b Mac \u30e6\u30fc\u30b6\u30fc\u5411\u3051\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":12314,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[27],"tags":[],"acf":false,"_links":{"self":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12313"}],"collection":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/comments?post=12313"}],"version-history":[{"count":15,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12313\/revisions"}],"predecessor-version":[{"id":12319,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/posts\/12313\/revisions\/12319"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media\/12314"}],"wp:attachment":[{"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/media?parent=12313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/categories?post=12313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sitest.jp\/blog\/wp-json\/wp\/v2\/tags?post=12313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}