{"id":1030,"date":"2021-03-19T03:44:09","date_gmt":"2021-03-18T19:44:09","guid":{"rendered":"https:\/\/byy3.com\/?p=1030"},"modified":"2021-03-19T05:55:41","modified_gmt":"2021-03-18T21:55:41","slug":"ubuntu%e7%bc%96%e8%af%91%e5%ae%89%e8%a3%85python3-9%e5%92%8cpip3%e8%ae%be%e7%bd%ae%e8%bd%af%e9%93%be%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/byy3.com\/?p=1030","title":{"rendered":"ubuntu\u7f16\u8bd1\u5b89\u88c5python3.9\u548cpip3\u8bbe\u7f6e\u8f6f\u94fe\u63a5"},"content":{"rendered":"<p>1 \u5b89\u88c5\u7f16\u8bd1\u4f9d\u8d56\u9879<br \/>\nsudo apt install -y wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev<\/p>\n<p>2 \u4e0b\u8f7d\u6e90\u7801\u5305<br \/>\nwget https:\/\/www.python.org\/ftp\/python\/3.9.1\/Python-3.9.1.tgz<br \/>\ntar -zxvf Python-3.9.0b4.tgz<\/p>\n<p>3 \u7f16\u8bd1\u5b89\u88c5<br \/>\ncd Python3.9.1\/<\/p>\n<p>.\/configure --prefix=\/usr\/local\/python3 # pip3\u4f7f\u7528ssl<\/p>\n<p>#\u7f16\u8bd1<br \/>\nmake<\/p>\n<p>#\u5b89\u88c5<br \/>\nsudo make install<\/p>\n<p>4 \u8bbe\u7f6e\u8f6f\u94fe\u63a5<br \/>\n\u6267\u884cll \/usr\/local\/python3\/bin\u67e5\u770b\u5b89\u88c5\u540e\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u5176\u4e2dpython3\u662f\u6307\u5411python3.9\u7684\u8f6f\u94fe\u63a5\uff0cpip3\u548cpip3.9\u91cc\u9762\u7684\u5185\u5bb9\u4e00\u6837\uff0c\u53ea\u9700\u8981\u5728\/usr\/bin\/\u76ee\u5f55\u4e0b\u6dfb\u52a0\u8fd9\u4e24\u4e2a\u6587\u4ef6\u7684\u8f6f\u94fe\u63a5\u5373\u53ef<\/p>\n<p>\u6267\u884cll \/usr\/bin | grep python\u5148\u67e5\u770b\u4e4b\u524dpython\u5bf9\u5e94\u8f6f\u94fe\u63a5\uff0c\u6bcf\u4e2a\u4eba\u60c5\u51b5\u90fd\u4e0d\u4e00\u6837\uff0c\u4f46\u8bbe\u7f6e\u65b9\u6cd5\u662f\u4e00\u6837\u7684\uff0c\u5220\u9664\u539f\u6765\u7684\u8f6f\u94fe\u63a5\uff0c\u7136\u540e\u91cd\u65b0\u6307\u5b9a\u5373\u53ef<\/p>\n<p>\u5220\u9664\u539f\u6765\u7684pip3\u8f6f\u94ferm \/usr\/local\/bin\/pip3<\/p>\n<p>sudo rm python # \u6700\u597d\u5728\u5220\u9664\u4e4b\u524d\u5907\u4efd mv \/usr\/bin\/python \/usr\/bin\/python.bak<br \/>\nsudo rm python3 #\u5e76\u4e0d\u4f1a\u5220\u9664 python2.7 \u548c python3.5 \u6700\u597d\u5728\u5220\u9664\u4e4b\u524d\u5907\u4efd mv \/usr\/bin\/python \/usr\/bin\/python3.bak<\/p>\n<p>sudo ln -s \/usr\/local\/python3\/bin\/python3.9 \/usr\/bin\/python3<br \/>\nsudo ln -s \/usr\/local\/python3\/bin\/python3.9 \/usr\/bin\/python<\/p>\n<p>#\u4e3a pip \u8bbe\u7f6e\u8f6f\u94fe\u63a5<br \/>\nsudo ln -s \/usr\/local\/python3\/bin\/pip3.9 \/usr\/bin\/pip3<br \/>\nsudo ln -s \/usr\/local\/python3\/bin\/pip3.9 \/usr\/bin\/pip<\/p>\n<p>\u6267\u884cll \/usr\/bin | grep python\u548cll \/usr\/bin | grep pip\u67e5\u770b\u8bbe\u7f6e\u540e\u7684\u8f6f\u94fe\u63a5\uff0c\u8bbe\u7f6eok<\/p>\n<p>&nbsp;<\/p>\n<p>5 pip\u9519\u8bef\u5904\u7406<br \/>\n\u5b89\u88c5\u5b8c\u6210\u4ee5\u540e\u8fd8\u6709\u4e2a\u4e8b\u5c31\u662f\u5728\u4f7f\u7528pip\u5b89\u88c5\u7b2c\u4e09\u65b9\u5e93\u4f1a\u51fa\u73b0\u95ee\u9898\uff0c\u6267\u884cpip list\uff0c\u5982\u4e0b\uff1a<\/p>\n<p>\u53ef\u4ee5\u76f4\u63a5\u5220\u9664<\/p>\n<p>\u610f\u601d\u662f\u5728\u6267\u884clsb_release -a\u8fd9\u4e2a\u547d\u4ee4\u51fa\u73b0\u95ee\u9898\uff0clsb_release\u8fd9\u4e2a\u6587\u4ef6\u5728\u76ee\u5f55\/usr\/bin\u4e0b<\/p>\n<p>\u6709\u7684\u535a\u6587\u8bf4\u5220\u4e86\u8fd9\u4e2a\u6587\u4ef6\u5c31ok\uff0c\u4e0d\u5220\u4e5f\u53ef\u4ee5\uff0c\u6267\u884csudo vi \/usr\/bin\/lsb_release\u5c06\u7b2c\u4e00\u884c\u4e2d\u7684python3\u6539\u4e3apython3.5\uff0c\u56e0\u4e3a\u4e4b\u524d\u7684python3\u662f\u6307\u5411python3.5\u7684\uff0c\u8ba9\u5b83\u4f7f\u7528\u539f\u6765\u7684\u89e3\u91ca\u5668\u5373\u53ef\u3002\u7136\u540e\u518d\u6267\u884cpip list\uff0c\u5df2\u7ecf\u6ca1\u6709\u95ee\u9898\u4e86 \u3010\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5220\u9664\u8be5\u6587\u4ef6\u3011<\/p>\n<p>6 \u6dfb\u52a0\u7b2c\u4e09\u65b9\u5e93\u5b89\u88c5\u6e90<br \/>\n\u73a9python\u9700\u8981\u5b89\u88c5\u5f88\u591a\u7684\u7b2c\u4e09\u65b9\u6a21\u5757\uff0c\u76f4\u63a5\u7528pip\u4e0b\u8f7d\u5b89\u88c5\u4f1a\u6bd4\u8f83\u6162\uff0c\u53ef\u6dfb\u52a0\u56fd\u5185\u955c\u50cf\u6e90\u5730\u5740\uff0c\u4e0b\u8f7d\u7684\u6587\u4ef6\u65f6\u4e00\u6837\u7684\uff0c\u4f46\u901f\u5ea6\u4f1a\u5feb\u5f88\u591a\u3002\u914d\u7f6e\u65b9\u6cd5\uff1a<\/p>\n<p>a. \u627e\u5230\u4e0b\u5217\u6587\u4ef6\uff0c\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u4e4b\u95f4\u521b\u5efa\u76f8\u5e94\u76ee\u5f55\u548c\u6587\u4ef6\u5373\u53ef<\/p>\n<p>~\/.pip\/pip.conf<br \/>\n1<br \/>\nb. \u5728\u4e0a\u8ff0\u6587\u4ef6\u4e2d\u6dfb\u52a0\u6216\u4fee\u6539\uff1a<\/p>\n<p>[global]<br \/>\nindex-url = https:\/\/mirrors.aliyun.com\/pypi\/simple\/<\/p>\n<p>[install]<br \/>\ntrusted-host=mirrors.aliyun.com<\/p>\n<p>\u3010\u53c2\u8003\u94fe\u63a5\u3011<\/p>\n<pre class=\"line-numbers language-bash\"><code class=\" language-bash\">ln -s \/usr\/local\/python3\/bin\/pip3 \/usr\/bin\/pip3<\/code><\/pre>\n<p>https:\/\/blog.csdn.net\/weixin_42482896\/article\/details\/107460100<br \/>\nhttp:\/\/www.chenxm.cc\/article\/1078.html<br \/>\n\u5982\u679cpip install\u7684\u65f6\u5019\uff0c\u62a5\u9519 ssl\u7684\u5f02\u5e38\uff0c\u8bf7\u53c2\u8003\u8fd9\u4e2a<br \/>\n\u5982\u679cpip install\u7684\u65f6\u5019\uff0c\u62a5\u9519 ssl\u7684\u5f02\u5e38\uff0c\u8bf4\u660e\u7cfb\u7edf\u7684openssl\u7248\u672c\u592a\u4f4e\uff0c\u9700\u8981\u81ea\u5b9a\u4e49openssl\u91cd\u65b0\u7f16\u8bd1\u5b89\u88c5<br \/>\n\u4e4b\u524d\u7684openssl\uff1a<br \/>\nopenssl version<\/p>\n<blockquote><p>OpenSSL 1.0.1f 6 Jan 2014<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/p><\/blockquote>\n<hr \/>\n<p>\u91cd\u65b0\u914d\u7f6epip\u548cpip2\u548cpip3\u5bf9\u5e94\u7248\u672c<\/p>\n<p>nano \/usr\/bin\/pip<\/p>\n<p>\u91cd\u65b0\u8bbe\u7f6epip\u8f6f\u8fde\u63a5<\/p>\n<p>\u4f7f\u7528wich pip3 \u67e5\u770b\u8f6f\u94fe\u5730\u5740 \u518d\u4f7f\u7528python3 -m pip -V\u67e5\u770bpip3\u771f\u5b9e\u5730\u5740<\/p>\n<p>\u5220\u9664\u8f6f\u94fe<\/p>\n<p>\u91cd\u65b0\u8bbe\u7f6e ln -s \/usr\/local\/python3\/lib\/python3.9\/site-packages\/pip <span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">usr<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">local<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">bin<\/span><span class=\"crayon-o\">\/<\/span><span class=\"crayon-v\">pip3<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 \u5b89\u88c5\u7f16\u8bd1\u4f9d\u8d56\u9879 sudo apt install -y wget build-essential libr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[566,567,568],"class_list":["post-1030","post","type-post","status-publish","format-standard","hentry","category-python","tag-python3","tag-python3-9","tag-python"],"_links":{"self":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/1030","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1030"}],"version-history":[{"count":0,"href":"https:\/\/byy3.com\/index.php?rest_route=\/wp\/v2\/posts\/1030\/revisions"}],"wp:attachment":[{"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1030"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/byy3.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}