{"id":475,"date":"2025-03-18T10:40:41","date_gmt":"2025-03-18T10:40:41","guid":{"rendered":"https:\/\/linuxjk.cn\/?p=475"},"modified":"2025-03-18T10:47:14","modified_gmt":"2025-03-18T10:47:14","slug":"%e6%ba%90%e7%a0%81%e5%8c%85%e7%bc%96%e8%af%91%e7%9a%84%e5%ae%89%e8%a3%85%e9%80%89%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/linuxjk.cn\/?p=475","title":{"rendered":"\u6e90\u7801\u5305\u7f16\u8bd1\u7684\u5b89\u88c5\u9009\u9879"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"475\" class=\"elementor elementor-475\">\n\t\t\t\t<div class=\"elementor-element elementor-element-25d5bac e-flex e-con-boxed e-con e-parent\" data-id=\"25d5bac\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-ba4b660 elementor-widget elementor-widget-text-editor\" data-id=\"ba4b660\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/linuxjk.cn\/?p=475\/#altinstall_%E7%9B%AE%E6%A0%87%E4%BC%9A%E7%A1%AE%E4%BF%9D%E6%82%A8%E7%9A%84%E6%9C%BA%E5%99%A8%E4%B8%8A%E7%9A%84%E9%BB%98%E8%AE%A4_Python_%E4%B8%8D%E5%8F%97%E5%BD%B1%E5%93%8D%EF%BC%8C%E6%88%96%E8%80%85%E9%81%BF%E5%85%8D%E8%A6%86%E7%9B%96%E7%B3%BB%E7%BB%9F_Python%E3%80%82\" >altinstall \u76ee\u6807\u4f1a\u786e\u4fdd\u60a8\u7684\u673a\u5668\u4e0a\u7684\u9ed8\u8ba4 Python \u4e0d\u53d7\u5f71\u54cd\uff0c\u6216\u8005\u907f\u514d\u8986\u76d6\u7cfb\u7edf\u00a0Python\u3002<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/linuxjk.cn\/?p=475\/#%E2%80%9Cmake_install%E2%80%9D%E5%92%8C%E2%80%9Cmake_altinstall%E2%80%9D%E5%91%BD%E4%BB%A4%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB%EF%BC%8C%E9%99%A4%E4%BA%86%E5%9C%A8usrbin%E4%B8%AD%E7%9A%84%E9%93%BE%E6%8E%A5%E4%B9%8B%E5%A4%96%EF%BC%9F\" >\u201cmake install\u201d\u548c\u201cmake altinstall\u201d\u547d\u4ee4\u6709\u4ec0\u4e48\u533a\u522b\uff0c\u9664\u4e86\u5728\/usr\/bin\u4e2d\u7684\u94fe\u63a5\u4e4b\u5916\uff1f<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"altinstall_%E7%9B%AE%E6%A0%87%E4%BC%9A%E7%A1%AE%E4%BF%9D%E6%82%A8%E7%9A%84%E6%9C%BA%E5%99%A8%E4%B8%8A%E7%9A%84%E9%BB%98%E8%AE%A4_Python_%E4%B8%8D%E5%8F%97%E5%BD%B1%E5%93%8D%EF%BC%8C%E6%88%96%E8%80%85%E9%81%BF%E5%85%8D%E8%A6%86%E7%9B%96%E7%B3%BB%E7%BB%9F_Python%E3%80%82\"><\/span><code>altinstall<\/code> \u76ee\u6807\u4f1a\u786e\u4fdd\u60a8\u7684\u673a\u5668\u4e0a\u7684\u9ed8\u8ba4 Python \u4e0d\u53d7\u5f71\u54cd\uff0c\u6216\u8005\u907f\u514d\u8986\u76d6<strong>\u7cfb\u7edf\u00a0Python<\/strong>\u3002<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c10dac1 elementor-widget elementor-widget-text-editor\" data-id=\"c10dac1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>\u4eca\u5929\u5728\u7ed9\u65b0\u670d\u52a1\u5668\u7528\u6e90\u7801\u5305\u7f16\u8bd1\u5b89\u88c5python\u7684\u65f6\u5019\u53d1\u73b0\u4e86\u4e4b\u524d\u4e0d\u597d\u89e3\u51b3\u7684\u95ee\u9898\uff0c\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u5b89\u88c5\u5b8c\u65b0\u7248\u672c\u7684python\u4e4b\u540e\u7cfb\u7edf\u4e2d\u4f1a\u51fa\u73b0\u4e24\u79cd\u7248\u672c\u7684python\uff0c\u547d\u4ee4\u884c\u8f93\u5165python -v\u65f6\u4f1a\u51fa\u73b0\u663e\u793a\u65e7\u7248\u672c\u7684\u95ee\u9898\uff0c\u770b\u7740\u5f88\u96be\u53d7\u3002<\/strong><br \/><strong>\u539f\u56e0\uff1a\/usr\/bin\u76ee\u5f55\u4e0b\u7684\u94fe\u63a5\u201cpython\u201d\u4ecd\u7136\u5b58\u5728\uff0c\u6307\u5411\u9ed8\u8ba4\u7cfb\u7edf\u7248\u672c\u7684python2.6\u3002<\/strong><br \/><strong>\u89e3\u51b3\u529e\u6cd5\u662f\uff1a\u5f53\u5220\u9664\u5b83\uff0c\u5e76\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u8f6f\u94fe\u63a5\u6307\u5411python3.10\u3002<\/strong><br \/><strong>\u4f46\u662f\u4e4b\u524d\u5728\u4f7f\u7528python\u7684\u8fc7\u7a0b\u4e2d\u4f1a\u51fa\u73b0\u4e00\u4e9b\u6211\u6392\u67e5\u4e0d\u5230\u89e3\u51b3\u529e\u6cd5\u7684\u5947\u602a\u62a5\u9519\uff0c\u6240\u4ee5\u4eca\u5929\u5b89\u88c5\u7684\u65f6\u5019\u4f7f\u7528\u4e86\u4ee5\u4e0b\u7684\u7f16\u8bd1\u9009\u9879\u548c<span style=\"text-decoration: underline;\">make altinstall<\/span>\u8fd9\u4e2a\u5b89\u88c5\u547d\u4ee4\uff1a<\/strong><\/p><p><strong>.\/configure &#8211;enable-optimizations &#8211;prefix=\/usr\/local\/python3.10<\/strong><br \/><strong># \u7f16\u8bd1\u5e76\u5b89\u88c5\uff08-j4 \u8868\u793a\u4f7f\u75284\u7ebf\u7a0b\u52a0\u901f\uff09<\/strong><br \/><strong>make -j4<\/strong><br \/><strong>sudo make altinstall<\/strong><\/p><p><strong>\u5173\u952e\u53c2\u6570\u8bf4\u660e\uff1a<\/strong><br \/><strong>&#8211;enable-optimizations\uff1a\u542f\u7528\u4f18\u5316\uff0c\u63d0\u5347\u8fd0\u884c\u6548\u7387\u3002<\/strong><br \/><strong>&#8211;prefix\uff1a\u6307\u5b9a\u5b89\u88c5\u8def\u5f84\uff0c\u907f\u514d\u8986\u76d6\u7cfb\u7edf\u9ed8\u8ba4 Python \u73af\u5883\u3002<\/strong><br \/><strong>altinstall\uff1a\u4fdd\u7559\u7cfb\u7edf\u539f Python \u7248\u672c\uff0c<\/strong><\/p><p><strong>\u539f\u7406\uff1a<span style=\"text-decoration: underline;\">altinstall\u8df3\u8fc7\u521b\u5efapython\u94fe\u63a5\u548c\u624b\u518c\u9875\u94fe\u63a5\u7684\u64cd\u4f5c\u3002<\/span><\/strong><\/p><p><strong>\u4e5f\u5c31\u662f\u5b89\u88c5python\u7684\u65f6\u5019make install \u662f\u53ef\u4ee5\u7528 make altinstall\u4ee3\u66ff\u7684\uff0c\u800c\u4e14\u66f4\u597d\u7528<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-62cf9e7 elementor-widget elementor-widget-heading\" data-id=\"62cf9e7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"%E2%80%9Cmake_install%E2%80%9D%E5%92%8C%E2%80%9Cmake_altinstall%E2%80%9D%E5%91%BD%E4%BB%A4%E6%9C%89%E4%BB%80%E4%B9%88%E5%8C%BA%E5%88%AB%EF%BC%8C%E9%99%A4%E4%BA%86%E5%9C%A8usrbin%E4%B8%AD%E7%9A%84%E9%93%BE%E6%8E%A5%E4%B9%8B%E5%A4%96%EF%BC%9F\"><\/span>\u201cmake install\u201d\u548c\u201cmake altinstall\u201d\u547d\u4ee4\u6709\u4ec0\u4e48\u533a\u522b\uff0c\u9664\u4e86\u5728\/usr\/bin\u4e2d\u7684\u94fe\u63a5\u4e4b\u5916\uff1f<span class=\"ez-toc-section-end\"><\/span><\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-61d6589 elementor-widget elementor-widget-text-editor\" data-id=\"61d6589\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>&#8212;&#8211;\u5c0a\u91cd\u539f\u521b\u00a0 \u00a0 \u539f\u6587\u94fe\u63a5\uff1a<\/p><p><a href=\"https:\/\/dev59.com\/rWQo5IYBdhLWcg3wfPUa\">&#8220;make install&#8221;\u548c&#8221;make altinstall&#8221;\u4e4b\u95f4\u7684\u7ec6\u8282\u5dee\u5f02 makefile installation &#8211; Dev59<\/a><\/p><p>\u539f\u6587\u90e8\u5206\u5185\u5bb9\u5f15\u7528\uff1a<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-29108b1 elementor-widget elementor-widget-text-editor\" data-id=\"29108b1\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>\u00a0<\/p><p><strong>\u7b80\u800c\u8a00\u4e4b\uff1aaltinstall \u8df3\u8fc7\u521b\u5efa python \u94fe\u63a5\u548c\u624b\u518c\u9875\u9762\u94fe\u63a5\uff0cinstall \u5c06\u9690\u85cf\u7cfb\u7edf\u4e8c\u8fdb\u5236\u6587\u4ef6\u548c\u624b\u518c\u9875\u9762\u3002<\/strong><\/p><p><span style=\"text-decoration: underline;\"><strong>\u624b\u518c\u9875\u9762\u5c31\u662f man python\u7684\u663e\u793a\u7ed3\u679c\uff0c\u786e\u5207\u6765\u8bf4\uff1a\u5f53\u8fd0\u884c\u201cman\u201d\u7a0b\u5e8f\u65f6\uff0c\u5b83\u4f1a\u67e5\u627e\u5df2\u5b89\u88c5\u7684\u624b\u518c\u9875\u3002\u5728\u8fd0\u884c\u201caltinstall\u201d\u540e\u67e5\u770b2.7\u624b\u518c\u9875\uff0c\u9700\u8981\u4f7f\u7528\u201cman python2.7\u201d\u3002<\/strong><\/span><\/p><p><strong>\u8ba9\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u751f\u6210\u7684 Makefile\uff01<\/strong><\/p><p><strong>\u9996\u5148\u662f\u5b89\u88c5\u76ee\u6807\uff1a<\/strong><\/p><p><strong>install: altinstall bininstall maninstall<\/strong><br \/><strong>\u5b83\u53ef\u4ee5\u5b8c\u6210altinstall\u7684\u6240\u6709\u529f\u80fd\uff0c\u8fd8\u5305\u62ecbininstall\u548cmaninstall<\/strong><\/p><p><strong>\u8fd9\u91cc\u662fbininstall\uff1b\u5b83\u53ea\u662f\u521b\u5efa\u4e86python\u548c\u5176\u4ed6\u7b26\u53f7\u94fe\u63a5\u3002<\/strong><\/p><p><strong># Install the interpreter by creating a symlink chain:<\/strong><br \/><strong># $(PYTHON) -&gt; python2 -&gt; python$(VERSION))<\/strong><br \/><strong># Also create equivalent chains for other installed files<\/strong><br \/><strong>bininstall: altbininstall<\/strong><br \/><strong>-if test -f $(DESTDIR)$(BINDIR)\/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)\/$(PYTHON); \\<\/strong><br \/><strong>then rm -f $(DESTDIR)$(BINDIR)\/$(PYTHON); \\<\/strong><br \/><strong>else true; \\<\/strong><br \/><strong>fi<\/strong><br \/><strong>(cd $(DESTDIR)$(BINDIR); $(LN) -s python2$(EXE) $(PYTHON))<\/strong><br \/><strong>-rm -f $(DESTDIR)$(BINDIR)\/python2$(EXE)<\/strong><br \/><strong>(cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)$(EXE) python2$(EXE))<\/strong><br \/><strong>&#8230; (More links created)<\/strong><br \/><strong>\u8fd9\u91cc\u662fmaninstall\uff0c\u5b83\u53ea\u662f\u521b\u5efa\u5230Python\u624b\u518c\u9875\u9762\u7684\u201c\u672a\u7248\u672c\u5316\u201d\u7684\u94fe\u63a5\u3002<\/strong><br \/><strong># Install the unversioned manual pages<\/strong><br \/><strong>maninstall: altmaninstall<\/strong><br \/><strong>-rm -f $(DESTDIR)$(MANDIR)\/man1\/python2.1<\/strong><br \/><strong>(cd $(DESTDIR)$(MANDIR)\/man1; $(LN) -s python$(VERSION).1 python2.1)<\/strong><br \/><strong>-rm -f $(DESTDIR)$(MANDIR)\/man1\/python.1<\/strong><br \/><strong>(cd $(DESTDIR)$(MANDIR)\/man1; $(LN) -s python2.1 python.1)<\/strong><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>altinstall \u76ee\u6807\u4f1a\u786e\u4fdd\u60a8\u7684\u673a\u5668\u4e0a\u7684\u9ed8\u8ba4 Python \u4e0d\u53d7\u5f71\u54cd\uff0c\u6216\u8005\u907f\u514d\u8986\u76d6\u7cfb\u7edf\u00a0Python\u3002 \u4eca [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[15],"class_list":["post-475","post","type-post","status-publish","format-standard","hentry","category-vxhs888p","tag-check_error"],"_links":{"self":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=475"}],"version-history":[{"count":7,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/475\/revisions"}],"predecessor-version":[{"id":482,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=\/wp\/v2\/posts\/475\/revisions\/482"}],"wp:attachment":[{"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxjk.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}