{"id":26245,"date":"2023-08-20T03:20:19","date_gmt":"2022-08-24T11:34:10","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/"},"modified":"2025-08-11T19:54:32","modified_gmt":"2025-08-11T11:54:32","slug":"%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/","title":{"rendered":"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u6211\u5c06\u5176\u4f5c\u4e3a\u5907\u5fd8\u5f55\u7684\u5907\u5fd8\u5f55\u8fdb\u884c\u8bb0\u5f55\u3002<\/p>\n<h2>1. \u5b89\u88c5pyenv<\/h2>\n<p>\u516c\u5f0f\u7684\u7f51\u5740<\/p>\n<p>\u9996\u5148\uff0c\u5728Git\u4e0a\u514b\u9686pyenv\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span>git clone https:\/\/github.com\/pyenv\/pyenv.git ~\/.pyenv\r\n<\/code><\/pre>\n<h2>\u901a\u8fc7\u8bbe\u7f6e PATH\uff0c\u521d\u59cb\u5316 pyenv\u3002<\/h2>\n<p>\u516c\u5f0f\u7f51\u5740<\/p>\n<p>\u8981\u5c06\u8def\u5f84\u6dfb\u52a0\u5230.bashrc\u6587\u4ef6\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">echo<\/span> <span class=\"s1\">'export PYENV_ROOT=\"$HOME\/.pyenv\"'<\/span> <span class=\"o\">&gt;&gt;<\/span> ~\/.bashrc\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">echo<\/span> <span class=\"s1\">'command -v pyenv &gt;\/dev\/null || export PATH=\"$PYENV_ROOT\/bin:$PATH\"'<\/span> <span class=\"o\">&gt;&gt;<\/span> ~\/.bashrc\r\n<span class=\"nv\">$ <\/span><span class=\"nb\">echo<\/span> <span class=\"s1\">'eval \"$(pyenv init -)\"'<\/span> <span class=\"o\">&gt;&gt;<\/span> ~\/.bashrc\r\n<\/code><\/pre>\n<h2>3. \u5b89\u88c5Python\u7f16\u8bd1\u6240\u9700\u7684\u8f6f\u4ef6\u5305<\/h2>\n<p>\u516c\u5f0f\u7db2\u5740<\/p>\n<p>\u4ee5\u4e0b\u662f\u9488\u5bf9\u6784\u5efa\u73af\u5883\u7684\u63a8\u8350\u64cd\u4f5c\u4e8b\u9879\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nb\">sudo <\/span>apt update<span class=\"p\">;<\/span> <span class=\"nb\">sudo <\/span>apt <span class=\"nb\">install <\/span>build-essential libssl-dev zlib1g-dev <span class=\"se\">\\<\/span>\r\nlibbz2-dev libreadline-dev libsqlite3-dev curl <span class=\"se\">\\<\/span>\r\nlibncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev\r\n<\/code><\/pre>\n<h2>4. \u5e94\u7528 Shell \u7684\u8bbe\u7f6e<\/h2>\n<p>\u5982\u679c\u662fBash\u7684\u8bdd\uff0c\u53ea\u9700\u8981\u5173\u95ed\u4e00\u6b21\u7ec8\u7aef\uff0cPATH\u5c31\u4f1a\u751f\u6548\u3002<br \/>\n\u5982\u679c\u4e0d\u5173\u95ed\u7ec8\u7aef\u7684\u8bdd\uff0c\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nv\">$ <\/span><span class=\"nb\">source<\/span> .bashrc\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u5c06\u5176\u4f5c\u4e3a\u5907\u5fd8\u5f55\u7684\u5907\u5fd8\u5f55\u8fdb\u884c\u8bb0\u5f55\u3002 1. \u5b89\u88c5pyenv \u516c\u5f0f\u7684\u7f51\u5740 \u9996\u5148\uff0c\u5728Git\u4e0a\u514b\u9686pyenv\u3002 $ g [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-26245","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5-6\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5-6\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-08-24T11:34:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-11T11:54:32+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u9896\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u9896\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/\",\"name\":\"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-08-24T11:34:10+00:00\",\"dateModified\":\"2025-08-11T11:54:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\"},\"description\":\"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\",\"name\":\"\u79d1, \u9896\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u9896\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0","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:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5-6\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5","og_description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5728ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5-6\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-08-24T11:34:10+00:00","article_modified_time":"2025-08-11T11:54:32+00:00","author":"\u79d1, \u9896","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u9896","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/","name":"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-08-24T11:34:10+00:00","dateModified":"2025-08-11T11:54:32+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e"},"description":"\u5173\u4e8e\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5728Ubuntu\u4e0a\u5f00\u59cb\u4f7f\u7528pyenv\u7684\u65b9\u6cd5"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e","name":"\u79d1, \u9896","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","caption":"\u79d1, \u9896"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%9c%a8ubuntu%e4%b8%8a%e5%bc%80%e5%a7%8b%e4%bd%bf%e7%94%a8pyenv%e7%9a%84%e6%96%b9%e6%b3%95-6\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26245","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=26245"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26245\/revisions"}],"predecessor-version":[{"id":56022,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/26245\/revisions\/56022"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=26245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=26245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=26245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}