{"id":803,"date":"2020-11-29T07:47:19","date_gmt":"2020-11-29T07:47:19","guid":{"rendered":"http:\/\/feellikelearning.com\/?p=803"},"modified":"2023-08-29T04:19:33","modified_gmt":"2023-08-29T04:19:33","slug":"cn-how-to-use-virtual-environment-for-python-3","status":"publish","type":"post","link":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/","title":{"rendered":"\u600e\u6837\u7528  Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ?"},"content":{"rendered":"\n<p><strong>\u600e\u6837\u521b\u5efa\u65b0\u7684Python 3\u865a\u62df\u73af\u5883?<\/strong><\/p>\n\n\n\n<!--more-->\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m venv ~\/venv3\/myproject<\/code><\/pre>\n\n\n\n<p><strong>\u600e\u6837\u4f7f\u7528\u5df2\u7ecf\u5efa\u7acb\u7684\u865a\u62df\u73af\u5883?<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>source ~\/venv3\/myproject\/bin\/activate\n(myproject) $<\/code><\/pre>\n\n\n\n<p>\u770b\u5230(myproject)\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u524d\u9762\u8bf4\u660e\u6b63\u5728\u4f7f\u7528\u53ebmyproject\u7684\u865a\u62df\u73af\u5883<\/p>\n\n\n\n<p><strong>Python\u865a\u62df\u73af\u5883 \/ Python virtual environment (virtualenv) \u5230\u5e95\u662f\u4ec0\u4e48\u610f\u601d?<\/strong><\/p>\n\n\n\n<p>\u8fdb\u5165\u865a\u62df\u73af\u5883\u540e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ which python\n\/Users\/feellikelearning\/venv3\/myproject\/bin\/python<\/code><\/pre>\n\n\n\n<p>\u8bf4\u660epython interpreter\u5730\u5740\u4e0d\u518d\u662f\u7cfb\u7edf\u9ed8\u8ba4\u7684, \u800c\u662fvirtual environment\u91cc\u9762\u7684. \u4ee5Mac OS\u4e3a\u4f8b, \u7cfb\u7edf\u9ed8\u8ba4\u662f\u662f\/user\/bin\/python. <\/p>\n\n\n\n<p>Python\u865a\u62df\u73af\u5883\u5c31\u662f\u4e00\u4e2a\u5b8c\u5168\u72ec\u7acb\u4e8e\u7cfb\u7edf\u9ed8\u8ba4\u7684Python\u73af\u5883, \u6709\u81ea\u5df1\u7684interpreter\u548clibrary, \u4e00\u822c\u53ef\u4ee5\u7ed9\u4e00\u4e2aPython project\u5efa\u7acb\u4e00\u4e2avirtual environment, \u8fd9\u6837\u53ef\u4ee5\u63a7\u5236Python\u7248\u672c\u548c\u7279\u70b9library\u7248\u672c.  <\/p>\n\n\n\n<p>\u9000\u51favirtual env<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">deactivate<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u600e\u6837\u521b\u5efa\u65b0\u7684Python 3\u865a\u62df\u73af\u5883?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.10 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning\" \/>\n<meta property=\"og:description\" content=\"\u600e\u6837\u521b\u5efa\u65b0\u7684Python 3\u865a\u62df\u73af\u5883?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\" \/>\n<meta property=\"og:site_name\" content=\"Feel Like Learning\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-29T07:47:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-29T04:19:33+00:00\" \/>\n<meta name=\"author\" content=\"feellikelearning\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"feellikelearning\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\"},\"author\":{\"name\":\"feellikelearning\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"headline\":\"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ?\",\"datePublished\":\"2020-11-29T07:47:19+00:00\",\"dateModified\":\"2023-08-29T04:19:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\"},\"wordCount\":37,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\",\"url\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\",\"name\":\"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/#website\"},\"datePublished\":\"2020-11-29T07:47:19+00:00\",\"dateModified\":\"2023-08-29T04:19:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/feellikelearning.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/feellikelearning.com\/#website\",\"url\":\"https:\/\/feellikelearning.com\/\",\"name\":\"Feel Like Learning\",\"description\":\"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230\",\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/feellikelearning.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\",\"name\":\"feellikelearning\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"caption\":\"feellikelearning\"},\"logo\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/","og_locale":"en_US","og_type":"article","og_title":"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning","og_description":"\u600e\u6837\u521b\u5efa\u65b0\u7684Python 3\u865a\u62df\u73af\u5883?","og_url":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/","og_site_name":"Feel Like Learning","article_published_time":"2020-11-29T07:47:19+00:00","article_modified_time":"2023-08-29T04:19:33+00:00","author":"feellikelearning","twitter_card":"summary_large_image","twitter_misc":{"Written by":"feellikelearning","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#article","isPartOf":{"@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/"},"author":{"name":"feellikelearning","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"headline":"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ?","datePublished":"2020-11-29T07:47:19+00:00","dateModified":"2023-08-29T04:19:33+00:00","mainEntityOfPage":{"@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/"},"wordCount":37,"commentCount":0,"publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/","url":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/","name":"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ? | Feel Like Learning","isPartOf":{"@id":"https:\/\/feellikelearning.com\/#website"},"datePublished":"2020-11-29T07:47:19+00:00","dateModified":"2023-08-29T04:19:33+00:00","breadcrumb":{"@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/feellikelearning.com\/index.php\/2020\/11\/29\/cn-how-to-use-virtual-environment-for-python-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/feellikelearning.com\/"},{"@type":"ListItem","position":2,"name":"\u600e\u6837\u7528 Python 3 \u7684\u865a\u62df\u73af\u5883? | How to use virtual environment for Python 3 ?"}]},{"@type":"WebSite","@id":"https:\/\/feellikelearning.com\/#website","url":"https:\/\/feellikelearning.com\/","name":"Feel Like Learning","description":"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230","publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/feellikelearning.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a","name":"feellikelearning","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","caption":"feellikelearning"},"logo":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/"},"url":"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/"}]}},"_links":{"self":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/803"}],"collection":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/comments?post=803"}],"version-history":[{"count":9,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":1949,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/803\/revisions\/1949"}],"wp:attachment":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/media?parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/categories?post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/tags?post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}