{"id":328,"date":"2021-01-29T10:42:35","date_gmt":"2021-01-29T02:42:35","guid":{"rendered":"http:\/\/www.333wen.com\/?p=328"},"modified":"2021-01-29T10:42:36","modified_gmt":"2021-01-29T02:42:36","slug":"virtualenv%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.333wen.com\/index.php\/virtualenv%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8\/","title":{"rendered":"virtualenv\u5b89\u88c5\u548c\u4f7f\u7528"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/www.cnblogs.com\/cwp-bg\/p\/python.html\">windows\u4e0bpython\u865a\u62df\u73af\u5883virtualenv\u5b89\u88c5\u548c\u4f7f\u7528<\/a><\/h1>\n\n\n\n<p><strong>\u524d\u9762\u4ecb\u7ecd\u4e86python\u5728ubuntu16.04\u73af\u5883\u4e0b\uff0cpython\u7684\u865a\u62df\u73af\u5883virtualenv\u7684\u5b89\u88c5\uff0c\u4e0b\u9762\u4ecb\u7ecd\u5728windows\u73af\u5883\u4e0b\u7684\u5b89\u88c5\u548c\u4f7f\u7528\u3002<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u73af\u5883\u4fe1\u606f\">\u73af\u5883\u4fe1\u606f<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u64cd\u4f5c\u7cfb\u7edf\uff1awindows10<\/li><li>python\u7248\u672c\uff1a3.6.3<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5b89\u88c5\">\u5b89\u88c5<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>\u4e0b\u8f7d\u5b89\u88c5python3.6.3<\/li><\/ol>\n\n\n\n<ul class=\"wp-block-list\"><li>\u8fdb\u5165\u5b98\u7f51\uff1a<a href=\"https:\/\/www.python.org\/downloads%EF%BC%88windows%EF%BC%89\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.python.org\/downloads\uff08windows\uff09<\/a><\/li><li>\u9009\u62e9\uff1aWindows x86-64 web-based installer<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Windows x86-64 web-based installer  # \u6307\u7684\u662f\u5b89\u88c5\u7684\u65f6\u5019\u9700\u8981\u8054\u7f51\uff0c\u4f53\u79ef\u5c0f\uff0c\u4e0b\u8f7d\u5feb\uff0c\u63a8\u8350\nWindows x86-64 executable installer  # \u6307\u7684\u662f\u4f7f\u7528XXX.exe\u6587\u4ef6\u7684\u65b9\u5f0f\u5b89\u88c5\uff0c\u4e0b\u8f7d\u4f53\u79ef\u5927\nWindows x86-64 embeddable zip file  # \u5d4c\u5165\u5f0f\u7248\u672c\n<\/code><\/pre>\n\n\n\n<ol class=\"wp-block-list\"><li>\u53cc\u51fb\u5f00\u59cb\u5b89\u88c5\uff0c\u6ce8\u610f\u52fe\u9009\u4e0aadd python to path,\u5176\u4ed6\u7684\u4e00\u8def\u9ed8\u8ba4\uff1b<\/li><li>\u6d4b\u8bd5\uff1a\u5728\u547d\u4ee4\u884c\u8f93\u5165python\uff0c\u663e\u793apython\u4ea4\u4e92\u754c\u9762\u5219\u5b89\u88c5\u6210\u529f\uff1b<\/li><\/ol>\n\n\n\n<p><strong>\u6ce8\u610f<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5982\u679c\u4e0d\u8bc6\u522bpython\uff0c\u6700\u53ef\u80fd\u7684\u539f\u56e0\u662f\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u6ca1\u6709\u6210\u529f\uff0c\u53bb\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u67e5\u770b\u4e00\u4e0b\uff0c\u6ca1\u6709\u5c31\u6dfb\u52a0\uff1b<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5b89\u88c5virtualenv\">\u5b89\u88c5virtualenv<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>python3.6.3\u7248\u672c\u81ea\u5e26\u4e86pip\uff0c\u4e3a\u4e86\u51cf\u5c11\u5b89\u88c5\u6b65\u9aa4\uff0c\u4f7f\u7528pip\u5b89\u88c5\uff1b<\/li><li>cmd\uff0c\u6253\u5f00windows\u547d\u4ee4\u884c\uff1b<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install virtualenv\n\npip install virtualenvwrapper  # \u8fd9\u662f\u5bf9virtualenv\u7684\u5c01\u88c5\u7248\u672c\uff0c\u4e00\u5b9a\u8981\u5728virtualenv\u540e\u5b89\u88c5 \n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8f93\u5165pip list,\u67e5\u770b\u5f53\u524d\u7684\u6240\u6709\u5b89\u88c5\u7684\u5305\uff1b<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u521b\u5efa\u865a\u62df\u73af\u5883\">\u521b\u5efa\u865a\u62df\u73af\u5883<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>\u9009\u62e9\u4e00\u4e2a\u7528\u6765\u5b58\u653e\u865a\u62df\u73af\u5883\u7684\u6587\u4ef6\uff0c\u5982E:\/python3<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cd E:python3  # \u8fdb\u5165\u8be5\u6587\u4ef6\nvirtualenv envname   # \u521b\u5efa\u4e00\u4e2a\u540d\u5b57\u4e3aenvname\u7684\u865a\u62df\u73af\u5883\ndir     # \u67e5\u770b\u5f53\u524d\u76ee\u5f55\u53ef\u4ee5\u77e5\u9053\u4e00\u4e2aenvname\u7684\u6587\u4ef6\u5df2\u7ecf\u88ab\u521b\u5efa\n\nvirtualenv -p python2 envname  # \u5982\u679c\u5b89\u88c5\u4e86\u591a\u4e2apython\u7248\u672c\uff0c\u5982py2\u548cpy3\uff0c\u9700\u8981\u6307\u5b9a\u4f7f\u7528\u54ea\u4e2a\u521b\u5efa\u865a\u62df\u73af\u5883\n<\/code><\/pre>\n\n\n\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5982\u679c\u4e0d\u8bc6\u522bvirtualenv\u547d\u4ee4\uff0c\u53ef\u80fd\u662fpython\u5b89\u88c5\u8def\u5f84\u6ca1\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u6216\u6ca1\u5b89\u88c5virtualenv\u6216\u6ca1\u6709\u91cd\u65b0\u6253\u5f00\u4e00\u4e2acmd\u7a97\u53e3\uff1b<\/li><li>\u542f\u52a8\u865a\u62df\u73af\u5883<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># \u8fdb\u5165\u865a\u62df\u73af\u5883\u6587\u4ef6\ncd envname\n# \u8fdb\u5165\u76f8\u5173\u7684\u542f\u52a8\u6587\u4ef6\u5939\ncd Scripts\n\nactivate  # \u542f\u52a8\u865a\u62df\u73af\u5883\ndeactivate # \u9000\u51fa\u865a\u62df\u73af\u5883\n\n<\/code><\/pre>\n\n\n\n<p>\u4e0b\u9762\u53ef\u4ee5\u81ea\u7531\u5730\u5728\u865a\u62df\u73af\u5883\u4e0b\u5b89\u88c5\u5404\u79cd\u5305\u4e86\u3002<\/p>\n\n\n\n<p><strong>\u95ee\u9898\u4e0e\u7ec6\u8282<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u6bcf\u6b21\u9700\u8981\u542f\u52a8\u865a\u62df\u73af\u5883\u7684\u65f6\u5019\u90fd\u9700\u8981\u8fdb\u5165\u865a\u62df\u73af\u5883\u7684\u6587\u4ef6\u5939\u7684Scripy\u7684\u76ee\u5f55\u4e0b\uff0c\u975e\u5e38\u4e0d\u65b9\u4fbf\uff0c\u53ef\u4ee5\u5c06Scripy\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d\u3002<\/li><li>\u5982\u679c\u7cfb\u7edf\u8fd8\u8981\u5b89\u88c5\u5176\u4ed6\u7684python\u7248\u672c\uff0c\u5982python2.7.13\uff1b\u5c06\u5176\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u540e\uff0c\u8fdb\u5165\u5b89\u88c5\u6587\u4ef6\u76ee\u5f55\uff0c\u5c06python.exe\u6587\u4ef6\u6539\u4e3apython2.exe\u6587\u4ef6\uff0c\u9632\u6b62\u547d\u4ee4\u51b2\u7a81\uff1b<\/li><li>\u5982\u679c\u540c\u65f6\u5b58\u5728\u591a\u4e2apython\u7248\u672c\uff0c\u90a3\u4e48pip\u4e5f\u6709\u591a\u4e2a\u7248\u672c\uff0c\u8fd9\u4e2a\u65f6\u5019\u4f7f\u7528pip\u5b89\u88c5\u9700\u8981\u6307\u5b9apython\u7248\u672c\u3002<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>python -m pip install xxx   # python3\u7248\u672c\u5b89\u88c5\u5305\npython2 -m pip install xxx  # python2\u7248\u672c\u5b89\u88c5\u5305\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>\u6bcf\u6b21\u6dfb\u52a0\u4e86\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4ee5\u540e\uff0c\u9700\u8981\u5173\u95ed\u5f53\u524d\u7684cmd\u7a97\u53e3\uff0c\u91cd\u65b0\u542f\u52a8\u4e00\u4e2a\u7a97\u53e3\u624d\u4f1a\u751f\u6548\u3002<\/strong><\/li><\/ul>\n\n\n\n<p>\u5206\u7c7b:&nbsp;<a href=\"https:\/\/www.cnblogs.com\/cwp-bg\/category\/1070209.html\" target=\"_blank\" rel=\"noreferrer noopener\">python<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>windows\u4e0bpython\u865a\u62df\u73af\u5883virtualenv\u5b89\u88c5\u548c\u4f7f\u7528 \u524d\u9762\u4ecb\u7ecd\u4e86python\u5728ubuntu16. [&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":""},"categories":[1],"tags":[],"class_list":["post-328","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/posts\/328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/comments?post=328"}],"version-history":[{"count":1,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/posts\/328\/revisions"}],"predecessor-version":[{"id":329,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/posts\/328\/revisions\/329"}],"wp:attachment":[{"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/media?parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/categories?post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.333wen.com\/index.php\/wp-json\/wp\/v2\/tags?post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}