{"id":1148963,"date":"2025-01-13T16:43:52","date_gmt":"2025-01-13T08:43:52","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1148963.html"},"modified":"2025-01-13T16:43:55","modified_gmt":"2025-01-13T08:43:55","slug":"python%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85arch%e5%8c%85","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1148963.html","title":{"rendered":"python\u5982\u4f55\u5b89\u88c5arch\u5305"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25175737\/f025e2a2-1b5a-4f27-85f4-e41f91af330b.webp\" alt=\"python\u5982\u4f55\u5b89\u88c5arch\u5305\" \/><\/p>\n<p><p> <strong>Python\u5b89\u88c5Arch\u5305\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528AUR\u7ba1\u7406\u5668\u3001\u624b\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u3001\u4f7f\u7528PyPI\u7b49\u3002\u5efa\u8bae\u4f7f\u7528AUR\u7ba1\u7406\u5668\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u7b80\u5316\u5b89\u88c5\u8fc7\u7a0b\u5e76\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u9879\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u8be6\u7ec6\u63cf\u8ff0\uff1a<strong>\u4f7f\u7528AUR\u7ba1\u7406\u5668\uff08\u4f8b\u5982yay\u6216trizen\uff09\u5b89\u88c5Arch\u5305\u662f\u6700\u4e3a\u7b80\u4fbf\u7684\u65b9\u6cd5\u3002<\/strong>\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b89\u88c5\u4e00\u4e2aAUR\u7ba1\u7406\u5668\uff0c\u4f8b\u5982yay\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5728Arch Linux\u4e0a\u5b89\u88c5yay\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo pacman -S --needed git base-devel<\/p>\n<p>git clone https:\/\/aur.archlinux.org\/yay.git<\/p>\n<p>cd yay<\/p>\n<p>makepkg -si<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5yay\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528\u5b83\u6765\u5b89\u88c5Python\u7684Arch\u5305\u3002\u4f8b\u5982\uff0c\u5b89\u88c5\u4e00\u4e2a\u7279\u5b9a\u7684Python\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">yay -S python-somepackage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e00\u8fc7\u7a0b\u4e2d\uff0cyay\u4f1a\u81ea\u52a8\u5904\u7406\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u786e\u4fdd\u5b89\u88c5\u8fc7\u7a0b\u7684\u987a\u5229\u8fdb\u884c\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5176\u4ed6\u5b89\u88c5\u65b9\u6cd5\u53ca\u66f4\u591a\u7ec6\u8282\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528AUR\u7ba1\u7406\u5668<\/h2>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5yay<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e2aAUR\u7ba1\u7406\u5668\u3002\u5728\u8fd9\u91cc\u6211\u4eec\u9009\u62e9yay\u3002\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo pacman -S --needed git base-devel<\/p>\n<p>git clone https:\/\/aur.archlinux.org\/yay.git<\/p>\n<p>cd yay<\/p>\n<p>makepkg -si<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>sudo pacman -S --needed git base-devel<\/code>\u547d\u4ee4\u4f1a\u5b89\u88c5\u6240\u9700\u7684\u5f00\u53d1\u5de5\u5177\u548cgit\u3002\u63a5\u7740\uff0c\u6211\u4eec\u901a\u8fc7git\u514b\u9686yay\u7684AUR\u4ed3\u5e93\u5e76\u6784\u5efa\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u4f7f\u7528yay\u5b89\u88c5Python\u5305<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5yay\u540e\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u4f7f\u7528\u5b83\u6765\u5b89\u88c5AUR\u4e2d\u7684Python\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">yay -S python-somepackage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>yay\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u3001\u6784\u5efa\u5e76\u5b89\u88c5\u8be5\u5305\uff0c\u540c\u65f6\u5904\u7406\u6240\u6709\u4f9d\u8d56\u5173\u7cfb\u3002\u5982\u679c\u4f60\u4e0d\u786e\u5b9a\u5305\u7684\u5177\u4f53\u540d\u79f0\uff0c\u53ef\u4ee5\u4f7f\u7528yay\u8fdb\u884c\u641c\u7d22\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">yay -Ss python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u5217\u51fa\u6240\u6709\u5305\u542b&quot;python&quot;\u7684\u5305\uff0c\u5e2e\u52a9\u4f60\u627e\u5230\u9700\u8981\u7684\u5305\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u624b\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5<\/h2>\n<\/p>\n<p><h3>1\u3001\u4e0b\u8f7dPKGBUILD\u6587\u4ef6<\/h3>\n<\/p>\n<p><p>\u5982\u679c\u4e0d\u60f3\u4f7f\u7528AUR\u7ba1\u7406\u5668\uff0c\u4e5f\u53ef\u4ee5\u624b\u52a8\u4e0b\u8f7d\u5e76\u6784\u5efa\u5b89\u88c5\u5305\u3002\u9996\u5148\uff0c\u627e\u5230\u4f60\u9700\u8981\u5b89\u88c5\u7684\u5305\u7684AUR\u9875\u9762\uff0c\u5e76\u4e0b\u8f7d\u5176PKGBUILD\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u4e0b\u8f7d\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">git clone https:\/\/aur.archlinux.org\/python-somepackage.git<\/p>\n<p>cd python-somepackage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u6784\u5efa\u548c\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7dPKGBUILD\u6587\u4ef6\u540e\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6784\u5efa\u5e76\u5b89\u88c5\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">makepkg -si<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><code>makepkg -si<\/code>\u547d\u4ee4\u4f1a\u6784\u5efa\u5b89\u88c5\u5305\u5e76\u81ea\u52a8\u5b89\u88c5\u6240\u6709\u4f9d\u8d56\u9879\u3002\u5728\u6784\u5efa\u8fc7\u7a0b\u4e2d\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u624b\u52a8\u786e\u8ba4\u67d0\u4e9b\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528PyPI<\/h2>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5pip<\/h3>\n<\/p>\n<p><p>Python\u5305\u7ba1\u7406\u5de5\u5177pip\u662f\u53e6\u4e00\u4e2a\u5e38\u7528\u7684\u5b89\u88c5\u65b9\u6cd5\u3002\u9996\u5148\uff0c\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86pip\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo pacman -S python-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u4f7f\u7528pip\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5pip\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u5b89\u88c5Python\u5305\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install somepackage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>pip\u4f1a\u81ea\u52a8\u4ecePyPI\u4e0b\u8f7d\u5e76\u5b89\u88c5\u5305\u3002\u5982\u679c\u4f60\u9700\u8981\u7279\u5b9a\u7248\u672c\u7684\u5305\uff0c\u53ef\u4ee5\u6307\u5b9a\u7248\u672c\u53f7\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install somepackage==1.0.0<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u7ba1\u7406\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u907f\u514d\u5305\u4e4b\u95f4\u7684\u51b2\u7a81\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528venv\u6a21\u5757\u6765\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv myenv<\/p>\n<p>source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u6240\u6709\u7684pip\u64cd\u4f5c\u90fd\u5c06\u5728\u8be5\u73af\u5883\u5185\u8fdb\u884c\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u4f7f\u7528Anaconda\u6216Miniconda<\/h2>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5Anaconda\u6216Miniconda<\/h3>\n<\/p>\n<p><p>Anaconda\u548cMiniconda\u662f\u7528\u4e8e\u7ba1\u7406Python\u73af\u5883\u548c\u5305\u7684\u5f3a\u5927\u5de5\u5177\u3002\u9996\u5148\uff0c\u4e0b\u8f7d\u5e76\u5b89\u88c5Anaconda\u6216Miniconda\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">wget https:\/\/repo.anaconda.com\/miniconda\/Miniconda3-latest-Linux-x86_64.sh<\/p>\n<p>bash Miniconda3-latest-Linux-x86_64.sh<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u521b\u5efa\u548c\u7ba1\u7406\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u521b\u5efa\u548c\u7ba1\u7406Python\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda create -n myenv python=3.8<\/p>\n<p>conda activate myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u5728\u6fc0\u6d3b\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528conda\u5b89\u88c5\u5305\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install somepackage<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>conda\u4f1a\u81ea\u52a8\u5904\u7406\u5305\u7684\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u786e\u4fdd\u5305\u7684\u517c\u5bb9\u6027\u3002<\/p>\n<\/p>\n<p><h2>\u4e94\u3001\u603b\u7ed3<\/h2>\n<\/p>\n<p><p>\u5728Arch Linux\u4e0a\u5b89\u88c5Python\u5305\u6709\u591a\u79cd\u65b9\u6cd5\u3002<strong>\u4f7f\u7528AUR\u7ba1\u7406\u5668\uff08\u5982yay\uff09\u662f\u6700\u65b9\u4fbf\u5feb\u6377\u7684\u65b9\u6cd5<\/strong>\uff0c\u56e0\u4e3a\u5b83\u80fd\u591f\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5173\u7cfb\u5e76\u7b80\u5316\u5b89\u88c5\u8fc7\u7a0b\u3002\u624b\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u9002\u5408\u9ad8\u7ea7\u7528\u6237\uff0c\u63d0\u4f9b\u4e86\u66f4\u591a\u7684\u63a7\u5236\u6743\u3002\u4f7f\u7528pip\u548c\u865a\u62df\u73af\u5883\u662f\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\uff0c\u7279\u522b\u9002\u5408\u7ba1\u7406\u591a\u4e2aPython\u9879\u76ee\u3002\u6700\u540e\uff0cAnaconda\u548cMiniconda\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u73af\u5883\u7ba1\u7406\u529f\u80fd\uff0c\u9002\u5408\u9700\u8981\u7ba1\u7406\u590d\u6742\u73af\u5883\u7684\u7528\u6237\u3002\u6839\u636e\u5177\u4f53\u9700\u6c42\u9009\u62e9\u6700\u9002\u5408\u7684\u5b89\u88c5\u65b9\u6cd5\uff0c\u80fd\u591f\u63d0\u9ad8\u6548\u7387\u5e76\u51cf\u5c11\u95ee\u9898\u7684\u53d1\u751f\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Arch Linux\u4e0a\u5b89\u88c5Python\uff1f<\/strong><br \/>\u5728Arch Linux\u4e0a\u5b89\u88c5Python\u975e\u5e38\u7b80\u5355\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528Pacman\u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Python\u3002\u53ea\u9700\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>sudo pacman -S python<\/code>\u3002\u8fd9\u5c06\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u53ca\u5176\u4f9d\u8d56\u9879\u3002<\/p>\n<p><strong>\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5305\u65f6\u9700\u8981\u6ce8\u610f\u4ec0\u4e48\uff1f<\/strong><br \/>\u5982\u679c\u4f60\u60f3\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5305\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\uff0c\u8fd9\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\u3002\u9996\u5148\u786e\u4fdd\u4f60\u5b89\u88c5\u4e86Python\uff0c\u7136\u540e\u4f7f\u7528\u547d\u4ee4<code>pip install package_name==version<\/code>\u6765\u6307\u5b9a\u4f60\u9700\u8981\u7684\u7248\u672c\u3002\u8981\u67e5\u770b\u53ef\u7528\u7684\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install package_name==<\/code>\u5e76\u6309\u4e0bTab\u952e\u3002<\/p>\n<p><strong>\u5728Arch Linux\u4e0a\u66f4\u65b0Python\u5305\u7684\u6700\u4f73\u5b9e\u8df5\u662f\u4ec0\u4e48\uff1f<\/strong><br \/>\u8981\u4fdd\u6301Python\u5305\u7684\u6700\u65b0\u72b6\u6001\uff0c\u53ef\u4ee5\u5b9a\u671f\u68c0\u67e5\u66f4\u65b0\u3002\u4f7f\u7528<code>pip list --outdated<\/code>\u547d\u4ee4\u53ef\u4ee5\u5217\u51fa\u6240\u6709\u8fc7\u65f6\u7684\u5305\u3002\u7136\u540e\uff0c\u4f7f\u7528<code>pip install --upgrade package_name<\/code>\u547d\u4ee4\u9010\u4e2a\u66f4\u65b0\uff0c\u6216\u8005\u4f7f\u7528<code>pip install --upgrade --upgrade-strategy eager<\/code>\u6765\u66f4\u65b0\u6240\u6709\u8fc7\u65f6\u7684\u5305\uff0c\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u4f60\u7684\u73af\u5883\u4f7f\u7528\u6700\u65b0\u7684\u529f\u80fd\u548c\u5b89\u5168\u8865\u4e01\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Python\u5b89\u88c5Arch\u5305\u7684\u65b9\u6cd5\u5305\u62ec\u4f7f\u7528AUR\u7ba1\u7406\u5668\u3001\u624b\u52a8\u4e0b\u8f7d\u548c\u5b89\u88c5\u3001\u4f7f\u7528PyPI\u7b49\u3002\u5efa\u8bae\u4f7f\u7528AUR\u7ba1\u7406\u5668\uff0c\u56e0 [&hellip;]","protected":false},"author":3,"featured_media":1148969,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1148963"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1148963"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1148963\/revisions"}],"predecessor-version":[{"id":1148970,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1148963\/revisions\/1148970"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1148969"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1148963"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1148963"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1148963"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}