{"id":1761,"date":"2015-01-06T22:24:36","date_gmt":"2015-01-06T14:24:36","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=1761"},"modified":"2015-01-06T22:24:36","modified_gmt":"2015-01-06T14:24:36","slug":"%e5%9c%a8centos%e4%b8%8a%e5%ae%89%e8%a3%85virtualenv","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/1761.html","title":{"rendered":"\u5728CentOS\u4e0a\u5b89\u88c5VirtualENV"},"content":{"rendered":"<h5>\u5728CentOS\u4e0a\u5b89\u88c5VirtualENV<\/h5>\n<p>1.\u6e90\u7801\u5b89\u88c5<br \/>\n<a href=\"https:\/\/github.com\/pypa\/virtualenv\/releases\" target=\"_blank\">https:\/\/github.com\/pypa\/virtualenv\/releases<\/a><br \/>\n\u89e3\u538b\uff0c\u8fdb\u5165\u76ee\u5f55\uff0c\u7136\u540e\u201csudo python setup.py install\u201d\u5373\u53ef\u3002<\/p>\n<p>2.PIP\u5b89\u88c5<\/p>\n<pre class=\"lang:default decode:true\">$ sudo pip install virtualenv<\/pre>\n<p>3.Debian\/Ubuntu\u7c7b\u7cfb\u7edf<\/p>\n<pre class=\"lang:default decode:true\">$ sudo apt-get install python-virtualenv<\/pre>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<p><a href=\"https:\/\/virtualenv.pypa.io\/en\/latest\/installation.html\" target=\"_blank\">https:\/\/virtualenv.pypa.io\/en\/latest\/installation.html<\/a><\/p>\n<h5>\u4f7f\u7528VirtualENV<\/h5>\n<p>1.\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u76ee\u5f55<\/p>\n<pre class=\"lang:default decode:true\">$ mkdir test_env &amp;&amp; cd test_env<\/pre>\n<p>2.\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883<\/p>\n<pre class=\"lang:default decode:true\">$ virtualenv pyEnv\n$ cd pyEnv<\/pre>\n<p>3.\u6fc0\u6d3b\u8be5\u865a\u62df\u73af\u5883<\/p>\n<pre class=\"lang:default decode:true\">$ source bin\/activate<\/pre>\n<p>4.\u8bd5\u9a8c\u4e00\u4e0b<\/p>\n<pre class=\"lang:default decode:true\">(pyEnv)$ which python\n(pyEnv)$ which pip\n(pyEnv)$ python<\/pre>\n<p>5.\u9000\u51fa\u8be5\u865a\u62df\u73af\u5883<\/p>\n<pre class=\"lang:default decode:true\">(pyEnv)$ deactivate<\/pre>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\nVIRTUALENV_PATH=\/home\/high\/py_env\nREQUIRE_MODULE=\/home\/high\/require.pip\n\nfunction Install_Virtualenv()\n{\n    git clone https:\/\/github.com\/pypa\/virtualenv.git\n    cd virtualenv\n    python2.7 setup.py install\n    cd ..\n    rm -rf virtualenv\n}\nfunction Install_Virtualenv_wget()\n{\n    wget --no-check-certificate https:\/\/github.com\/pypa\/virtualenv\/archighve\/12.0.5.tar.gz\n    tar zxf virtualenv-12.0.5.tar.gz\n    cd virtualenv-12.0.5\n    python2.7 setup install\n    cd ..\n    rm -rf virtualenv-12.0.5\n}\nfunction Configure_Virtualenv()\n{\n    source $VIRTUALENV_PATH\/bin\/activate\n    pip install -r $REQUIRE_MODULE\n}\n\n\nif [ -f \"$VIRTUALENV_PATH\/bin\/activate\" ]; then\n    Configure_Virtualenv &gt;\/home\/high\/install-virtualenv.log 2&gt;&amp;1\n    echo Done.\nelse\n    echo VirtualENV not exists before.\n    if whighch virtualenv &gt;\/dev\/null 2&gt;&amp;1; then\n        echo configure VirtualENV\n        virtualenv $VIRTUALENV_PATH --python=python2.7 --no-site-packages\n        Configure_Virtualenv &gt;\/home\/high\/install-virtualenv.log 2&gt;&amp;1\n        echo Done.\n    else\n        echo install &amp; configure VirtualENV\n        Install_Virtualenv &gt;\/home\/high\/install-virtualenv.log 2&gt;&amp;1\n        virtualenv $VIRTUALENV_PATH --python=python2.7 --no-site-packages\n        Configure_Virtualenv &gt;\/home\/high\/install-virtualenv.log 2&gt;&amp;1\n        echo Done.\n    fi\nfi<\/pre>\n<p>&nbsp;<\/p>\n<h6>\u53c2\u8003\u94fe\u63a5\uff1a<\/h6>\n<ul>\n<li><a href=\"http:\/\/liuzhijun.iteye.com\/blog\/1872241\" target=\"_blank\">Python \u865a\u62df\u73af\u5883\uff1aVirtualenv<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/lzjun567\/note\" target=\"_blank\">lzjun567\/note \u2022 GitHub<\/a><\/li>\n<li><a href=\"http:\/\/www.nowamagic.net\/academy\/detail\/1330228\" target=\"_blank\">http:\/\/www.nowamagic.net\/academy\/detail\/1330228<\/a><\/li>\n<li><a href=\"https:\/\/virtualenv.pypa.io\/en\/latest\/userguide.html\" target=\"_blank\">https:\/\/virtualenv.pypa.io\/en\/latest\/userguide.html<\/a><\/li>\n<\/ul>\n<p>\u4e4b\u524d\u7528\u8fc7PyENV\uff0c\u6587\u7ae0\u8bb0\u5f55\u5728\uff1a<a title=\"\u5728Ubuntu\u4e0a\u5b89\u88c5pyenv\" href=\"http:\/\/ixyzero.com\/blog\/archives\/13.html\" target=\"_blank\">\u5728Ubuntu\u4e0a\u5b89\u88c5pyenv<\/a>\u00a0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728CentOS\u4e0a\u5b89\u88c5VirtualENV 1.\u6e90\u7801\u5b89\u88c5 https:\/\/github.com\/pypa\/vir [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,12],"tags":[8,428],"class_list":["post-1761","post","type-post","status-publish","format-standard","hentry","category-linux","category-tools","tag-python","tag-virtualenv"],"views":3157,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=1761"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/1761\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=1761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=1761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=1761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}