{"id":101,"date":"2015-08-12T17:54:52","date_gmt":"2015-08-12T08:54:52","guid":{"rendered":"http:\/\/boltech21.net\/blog\/vottie\/?p=101"},"modified":"2015-09-09T01:20:50","modified_gmt":"2015-09-08T16:20:50","slug":"python-development-env-and-install-django","status":"publish","type":"post","link":"https:\/\/boltech21.net\/blog\/vottie\/?p=101","title":{"rendered":"python\u305d\u306e4 \u74b0\u5883\u5468\u308a\u3068django\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u884c\u306b\u4f55\u3092\u66f8\u304f\u306e\u304b?<br \/>\n\u76f4\u63a5\u5b9f\u884c\u3057\u305f\u3044\u6642\u306f\u4ee5\u4e0b\u3092\u66f8\u304f\u3068\u826f\u3044\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">#!\/usr\/bin\/env python<\/pre>\n<p>\u5177\u4f53\u7684\u306b\u306f\u76f4\u63a5\u5b9f\u884c\u3057\u306a\u3044\u30af\u30e9\u30b9\u3092\u66f8\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u4e0d\u8981\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306f\u66f8\u3044\u3066\u304a\u3044\u305f\u65b9\u304c\u826f\u3055\u305d\u3046\u3002<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"># -*- coding: utf-8 -*-<\/pre>\n<p>ruby\u3067\u306erbenv\u307f\u305f\u3044\u306a\u306e\u306f?<br \/>\n\u308f\u305f\u3057\u3083\u3055\u304f\u3089\u306evps\u306bubuntu 14.04.02 LTS\u3092\u5165\u308c\u3066\u5b66\u7fd2\u4e2d\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ cat \/etc\/lsb-release\r\nDISTRIB_ID=Ubuntu\r\nDISTRIB_RELEASE=14.04\r\nDISTRIB_CODENAME=trusty\r\nDISTRIB_DESCRIPTION=&quot;Ubuntu 14.04.2 LTS&quot;<\/pre>\n<p>\u306a\u306e\u3067\u3059\u304c\u3001\u65e2\u306b\u4ee5\u4e0b\u306e\u72b6\u614b\u3002\u3053\u3053\u304b\u3089\u5b9f\u884c\u74b0\u5883\u306e\u5207\u308a\u66ff\u3048\u3068\u304b\u3067\u304d\u308b\u3093\u3060\u308d\u3046\u304b\u2026<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">$ find \/usr\/bin -name &quot;python*&quot; | xargs ls -l\r\nlrwxrwxrwx 1 root root       9 Dec 21  2013 \/usr\/bin\/python -&gt; python2.7\r\nlrwxrwxrwx 1 root root       9 Dec 21  2013 \/usr\/bin\/python2 -&gt; python2.7\r\n-rwxr-xr-x 1 root root 3345416 Jun 23 03:51 \/usr\/bin\/python2.7\r\nlrwxrwxrwx 1 root root       9 Mar 23  2014 \/usr\/bin\/python3 -&gt; python3.4\r\n-rwxr-xr-x 2 root root 4061272 Jun 20 00:35 \/usr\/bin\/python3.4\r\n-rwxr-xr-x 2 root root 4061272 Jun 20 00:35 \/usr\/bin\/python3.4m\r\nlrwxrwxrwx 1 root root      10 Mar 23  2014 \/usr\/bin\/python3m -&gt; python3.4m<\/pre>\n<p>ruby\u306erbenv\u307f\u305f\u3044\u306a\u306e\u306f\u3001direnv\u304bpyenv\u3089\u3057\u3044\u3002virtualenv\u306f\u305d\u306e\u524d\u307f\u305f\u3044\u3002\u8ab0\u304b\u305d\u306e\u8fba\u306e\u6b74\u53f2\u307f\u305f\u3044\u306a\u306e\u3068\u304b\u307e\u3068\u3081\u3066\u304f\u308c\u3093\u304b\u306a\u3002direnv\u306fpython\u3082ruby\u3082\u307e\u3068\u3081\u3066\u9762\u5012\u307f\u307e\u3063\u305b\u7684\u306a\u3082\u306e\u307f\u305f\u3044\u3060\u3051\u3069\u3001\u65e2\u306brbenv\u306f\u5c0e\u5165\u6e08\u3060\u3057\u3001\u4eca\u56de\u306fpyenv\u3067\u3084\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3059\u308b\u3002\u4ed6\u306e\u4eba\u306e\u3084\u308a\u65b9\u3092\u898b\u3064\u3064\u3001\u4ee5\u524d\u306brbenv\u5165\u308c\u305f\u306e\u3092history\u3067\u63a8\u6e2c\u3057\u306a\u304c\u3089\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u305f\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n% cd \/opt\r\n% sudo git clone git:\/\/github.com\/yyuu\/pyenv.git pyenv\r\n% sudo groupadd pyenv\r\n% sudo gpasswd -a \u30e6\u30fc\u30b6\u540d pyenv\r\n% sudo chgrp -R pyenv pyenv\r\n% sudo chmod -R g+rwxXs \/opt\/pyenv\r\n% sudo mkdir \/opt\/pyenv\/shims\r\n% sudo mkdir \/opt\/pyenv\/versions\r\n% sudo chmod -R g+rwxXs \/opt\/pyenv\/shims\r\n% sudo chmod -R g+rwxXs \/opt\/pyenv\/versions\r\n% echo 'export PYENV_ROOT=&quot;\/opt\/pyenv&quot;' &gt;&gt; .zshrc\r\n% echo 'if &#x5B; -d &quot;${PYENV_ROOT}&quot; ]; then' &gt;&gt; .zshrc\r\n% echo '    export PATH=${PYENV_ROOT}\/bin:$PATH' &gt;&gt; .zshrc\r\n% echo '    eval &quot;$(pyenv init -)&quot;' &gt;&gt; .zshrc\r\n% echo 'fi' &gt;&gt; ~\/.zshrc\r\n% source ~\/.zshrc\r\n<\/pre>\n<p>\u306a\u304a\u3001\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u306f\u4ee5\u4e0b\u3067\u3054\u3056\u3044\u307e\u3059 m(. .)m<\/p>\n<p><a href=\"http:\/\/qiita.com\/5t111111\/items\/e170fead91261621b054\" target=\"_blank\">Ubuntu 12.04\u3067pyenv\u3092\u5229\u7528\u3057\u3066\u901f\u653b\u3067Python3.4 + Nginx + uWSGI + Flask\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u74b0\u5883\u3092\u4f5c\u308b (Qiita)<\/a><\/p>\n<p><a href=\"http:\/\/www.takunoko.com\/blog\/ubuntu%E3%81%ABpython%E3%82%92%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%E3%81%97%E3%81%BE%E3%81%97%E3%81%9F%E3%80%82\/\" target=\"_blank\">Ubuntu\u306bpyenv\u3092\u7528\u3044\u3066pythn\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3057\u305f\u3002(\u305f\u304f\u306e\u3053Web)<\/a><\/p>\n<p>\/usr\/bin\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308bpython\u306f\u7f6e\u3044\u3068\u3044\u3066\u3001version 3.4.3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u524d\u306bdjango\u3068version\u306e\u6574\u5408\u6027\u306f\u78ba\u8a8d\u3057\u305f\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u305d\u3053\u305d\u3053\u6642\u9593\u304b\u304b\u308b\u3002\u4f55\u3084\u3089WARNING\u304c\u51fa\u3066\u308b\u304c\u3001\u6c17\u306b\u3057\u306a\u3044\u3063\u305f\u3089\u6c17\u306b\u3057\u306a\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\r\n% pyenv install 3.4.3\r\nDownloading Python-3.4.3.tgz...\r\n-&gt; https:\/\/yyuu.github.io\/pythons\/4281ff86778db65892c05151d5de738d\r\nInstalling Python-3.4.3...\r\nWARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?\r\nWARNING: The Python readline extension was not compiled. Missing the GNU readline lib?\r\nInstalled Python-3.4.3 to \/opt\/pyenv\/versions\/3.4.3\r\n\r\n% dpkg -l | grep bzip2\r\nii bzip2 1.0.6-5 amd64 high-quality block-sorting file compressor - utilities\r\n% dpkg -l | grep readline\r\nii libreadline6:amd64 6.3-4ubuntu2 amd64 GNU readline and history libraries, run-time libraries\r\nii readline-common 6.3-4ubuntu2 all GNU readline and history libraries, common files\r\nii rlwrap 0.37-5 amd64 readline feature command line wrapper\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>ruby\u3067\u3044\u3046\u3068\u3053\u308d\u306egem(\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406)\u306fpip\u3060\u305d\u3046\u3060\u3002pip\u306f\u5b9f\u884c\u74b0\u5883\u3092\u5148\u307b\u3069\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f3.4.3\u306b\u5207\u308a\u66ff\u3048\u305f\u3089\u5165\u3063\u3066\u305f\u3002\u306a\u306e\u3067django\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002<a href=\"https:\/\/www.djangoproject.com\/download\/\" target=\"_blank\">\u516c\u5f0f<\/a>\u306b\u3042\u308b\u901a\u308a\u30b3\u30de\u30f3\u30c9\u6253\u3063\u3066\u307f\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">%\u00a0pip install Django==1.8.3\r\nYou are using pip version 6.0.8, however version 7.1.0 is available.\r\nYou should consider upgrading via the 'pip install --upgrade pip' command.\r\nCollecting Django==1.8.3\r\nDownloading Django-1.8.3-py2.py3-none-any.whl (6.2MB)\r\n100% |################################| 6.2MB 70kB\/s\r\nInstalling collected packages: Django\r\n\r\nSuccessfully installed Django-1.8.3\r\n\r\n% python\r\nPython 3.4.3 (default, Aug 12 2015, 11:57:13)\r\n&#x5B;GCC 4.8.4] on linux\r\nType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\r\n&gt;&gt;&gt; import django\r\n&gt;&gt;&gt; print(django.get_version())\r\n1.8.3\r\n&gt;&gt;&gt;\r\n\r\n% <\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u306e\u5148\u982d\u884c\u306b\u4f55\u3092\u66f8\u304f\u306e\u304b? \u76f4\u63a5\u5b9f\u884c\u3057\u305f\u3044\u6642\u306f\u4ee5\u4e0b\u3092\u66f8\u304f\u3068\u826f\u3044\u3002 #!\/usr\/bin\/env python \u5177\u4f53\u7684\u306b\u306f\u76f4\u63a5\u5b9f\u884c\u3057\u306a\u3044\u30af\u30e9\u30b9\u3092\u66f8\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u4e0d\u8981\u3002 \u30c7\u30d5\u30a9\u30eb\u30c8\u30a8\u30f3\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u306f\u66f8\u3044\u3066\u304a\u3044\u305f\u65b9\u304c\u826f\u3055\u305d\u3046\u3002 # -*- coding: utf-8 -*- ruby\u3067\u306erbenv\u307f\u305f\u3044\u306a\u306e\u306f? \u308f\u305f\u3057\u3083\u3055\u304f\u3089\u306evps\u306bubuntu 14.04.02 LTS\u3092\u5165\u308c\u3066\u5b66\u7fd2\u4e2d\u3002 $ cat \/etc\/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=14.04 DISTRIB_CODENAME=trusty DISTRIB_DESCRIPTION=&quot;Ubuntu 14.04.2 LTS&quot; \u306a\u306e\u3067\u3059\u304c\u3001\u65e2\u306b\u4ee5\u4e0b\u306e\u72b6\u614b\u3002\u3053\u3053\u304b\u3089\u5b9f\u884c\u74b0\u5883\u306e\u5207\u308a\u66ff\u3048\u3068\u304b\u3067\u304d\u308b\u3093\u3060\u308d\u3046\u304b\u2026 $ find \/usr\/bin -name &quot;python*&quot; | xargs ls -l lrwxrwxrwx 1 root root 9 Dec 21 2013 \/usr\/bin\/python -&gt; python2.7 lrwxrwxrwx 1 root root 9 Dec 21 2013 \/usr\/bin\/python2 -&gt; python2.7 -rwxr-xr-x 1 root root 3345416 Jun 23 03:51 \/usr\/bin\/python2.7 lrwxrwxrwx 1 root root 9 Mar 23 2014 \/usr\/bin\/python3 -&gt; python3.4 -rwxr-xr-x 2 root root 4061272 Jun 20 00:35 \/usr\/bin\/python3.4 -rwxr-xr-x 2 root root 4061272 Jun 20 00:35 \/usr\/bin\/python3.4m lrwxrwxrwx 1 root root 10 Mar 23 2014 \/usr\/bin\/python3m -&gt; python3.4m ruby\u306erbenv\u307f\u305f\u3044\u306a\u306e\u306f\u3001direnv\u304bpyenv\u3089\u3057\u3044\u3002virtualenv\u306f\u305d\u306e\u524d\u307f\u305f\u3044\u3002\u8ab0\u304b\u305d\u306e\u8fba\u306e\u6b74\u53f2\u307f\u305f\u3044\u306a\u306e\u3068\u304b\u307e\u3068\u3081\u3066\u304f\u308c\u3093\u304b\u306a\u3002direnv\u306fpython\u3082ruby\u3082\u307e\u3068\u3081\u3066\u9762\u5012\u307f\u307e\u3063\u305b\u7684\u306a\u3082\u306e\u307f\u305f\u3044\u3060\u3051\u3069\u3001\u65e2\u306brbenv\u306f\u5c0e\u5165\u6e08\u3060\u3057\u3001\u4eca\u56de\u306fpyenv\u3067\u3084\u3063\u3066\u307f\u308b\u3053\u3068\u306b\u3059\u308b\u3002\u4ed6\u306e\u4eba\u306e\u3084\u308a\u65b9\u3092\u898b\u3064\u3064\u3001\u4ee5\u524d\u306brbenv\u5165\u308c\u305f\u306e\u3092history\u3067\u63a8\u6e2c\u3057\u306a\u304c\u3089\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u305f\u3002 % cd \/opt % sudo git clone git:\/\/github.com\/yyuu\/pyenv.git pyenv % sudo groupadd pyenv % sudo gpasswd -a \u30e6\u30fc\u30b6\u540d pyenv % sudo chgrp -R pyenv pyenv % sudo chmod -R g+rwxXs \/opt\/pyenv % sudo mkdir \/opt\/pyenv\/shims % sudo mkdir \/opt\/pyenv\/versions % sudo chmod -R g+rwxXs \/opt\/pyenv\/shims % sudo chmod -R g+rwxXs \/opt\/pyenv\/versions % echo &#8216;export PYENV_ROOT=&quot;\/opt\/pyenv&quot;&#8217; &gt;&gt; .zshrc % echo &#8216;if &#x5B; -d &quot;${PYENV_ROOT}&quot; ]; then&#8217; &gt;&gt; .zshrc % echo &#8216; export PATH=${PYENV_ROOT}\/bin:$PATH&#8217; &gt;&gt; .zshrc % echo &#8216; eval &quot;$(pyenv init -)&quot;&#8217; &gt;&gt; .zshrc % echo &#8216;fi&#8217; &gt;&gt; ~\/.zshrc % source ~\/.zshrc \u306a\u304a\u3001\u53c2\u8003\u306b\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u306e\u306f\u4ee5\u4e0b\u3067\u3054\u3056\u3044\u307e\u3059 m(. .)m Ubuntu 12.04\u3067pyenv\u3092\u5229\u7528\u3057\u3066\u901f\u653b\u3067Python3.4 + Nginx + uWSGI + Flask\u306aWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5b9f\u884c\u74b0\u5883\u3092\u4f5c\u308b (Qiita) Ubuntu\u306bpyenv\u3092\u7528\u3044\u3066pythn\u74b0\u5883\u3092\u69cb\u7bc9\u3057\u307e\u3057\u305f\u3002(\u305f\u304f\u306e\u3053Web) \/usr\/bin\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308bpython\u306f\u7f6e\u3044\u3068\u3044\u3066\u3001version 3.4.3\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u524d\u306bdjango\u3068version\u306e\u6574\u5408\u6027\u306f\u78ba\u8a8d\u3057\u305f\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306b\u306f\u305d\u3053\u305d\u3053\u6642\u9593\u304b\u304b\u308b\u3002\u4f55\u3084\u3089WARNING\u304c\u51fa\u3066\u308b\u304c\u3001\u6c17\u306b\u3057\u306a\u3044\u3063\u305f\u3089\u6c17\u306b\u3057\u306a\u3044\u3002 % pyenv install 3.4.3 Downloading Python-3.4.3.tgz&#8230; -&gt; https:\/\/yyuu.github.io\/pythons\/4281ff86778db65892c05151d5de738d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[12,8],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","category-computer","tag-django","tag-python"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Yc9l-1D","_links":{"self":[{"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/posts\/101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=101"}],"version-history":[{"count":5,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=\/wp\/v2\/posts\/101\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/boltech21.net\/blog\/vottie\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}