{"id":242,"date":"2026-08-11T08:54:31","date_gmt":"2026-08-11T00:54:31","guid":{"rendered":"https:\/\/blog.notiq.cn\/?p=242"},"modified":"2026-08-11T08:54:31","modified_gmt":"2026-08-11T00:54:31","slug":"uv%e5%ae%89%e8%a3%85%e5%88%b0d%e7%9b%98","status":"publish","type":"post","link":"https:\/\/blog.notiq.cn\/index.php\/2026\/08\/11\/uv%e5%ae%89%e8%a3%85%e5%88%b0d%e7%9b%98\/","title":{"rendered":"UV\u5b89\u88c5\u5230D\u76d8"},"content":{"rendered":"<h2>UV\u5378\u8f7d\u91cd\u88c5<\/h2>\n<pre><code>\u9ed8\u8ba4\u88c5c\u76d8\u5360\u7a7a\u95f4\u592a\u591a\nwindows\u73af\u5883<\/code><\/pre>\n<h3><strong>\u5b8c\u6574\u5220\u9664\u5efa\u8bae<\/strong><\/h3>\n<p>\u5148\u5728\u4ecd\u80fd\u4f7f\u7528 <code>uv<\/code> \u7684 PowerShell \u4e2d\u6e05\u7406 uv \u7ba1\u7406\u7684\u6570\u636e\uff1a<\/p>\n<pre><code>uv cache clean<\/code><\/pre>\n<p>\u67e5\u770b\u5e76\u8bb0\u5f55\u5168\u5c40\u5de5\u5177\u3001Python \u7684\u4f4d\u7f6e\uff1a<\/p>\n<pre><code>uv tool dir\nuv python dir<\/code><\/pre>\n<p>\u7136\u540e\u5378\u8f7d WinGet \u5305\uff1a<\/p>\n<pre><code>winget uninstall --id astral-sh.uv -e<\/code><\/pre>\n<p>\u5378\u8f7d\u5b8c\u6210\u540e\uff0c\u5220\u9664\u5f53\u524d\u673a\u5668\u4e0a\u7684\u6b8b\u7559\u76ee\u5f55\uff1a<\/p>\n<pre><code>Remove-Item -LiteralPath \"$HOME\\.local\\bin\\uv.exe\" `\n    -Force -ErrorAction SilentlyContinue\n\nRemove-Item -LiteralPath \"$HOME\\.local\\bin\\uvx.exe\" `\n    -Force -ErrorAction SilentlyContinue\n\nRemove-Item -LiteralPath \"$HOME\\.local\\bin\\uvw.exe\" `\n    -Force -ErrorAction SilentlyContinue\n\nRemove-Item -LiteralPath \"$env:LOCALAPPDATA\\uv\" `\n    -Recurse -Force -ErrorAction SilentlyContinue\n\nRemove-Item -LiteralPath \"$env:APPDATA\\uv\" `\n    -Recurse -Force -ErrorAction SilentlyContinue<\/code><\/pre>\n<p>\u8fd9\u4e9b\u76ee\u5f55\u5206\u522b\u53ef\u80fd\u5305\u542b\uff1a<\/p>\n<pre><code>$HOME\\.local\\bin       uv\u3001uvx\u3001uvw \u53ef\u6267\u884c\u6587\u4ef6\n%LOCALAPPDATA%\\uv      uv \u7f13\u5b58\n%APPDATA%\\uv           \u5168\u5c40\u5de5\u5177\u3001uv \u7ba1\u7406\u7684 Python\u3001\u7528\u6237\u914d\u7f6e<\/code><\/pre>\n<p>uv \u5b98\u65b9\u7684\u5378\u8f7d\u8bf4\u660e\u4e5f\u8981\u6c42\u5220\u9664 <code>uv<\/code>\u3001<code>uvx<\/code>\u3001<code>uvw<\/code>\uff0c\u5e76\u53ef\u8fdb\u4e00\u6b65\u5220\u9664\u7f13\u5b58\u3001Python \u5b89\u88c5\u76ee\u5f55\u548c\u5de5\u5177\u76ee\u5f55\u3002<\/p>\n<h3><strong>\u9a8c\u8bc1\u662f\u5426\u5220\u9664\u5e72\u51c0<\/strong><\/h3>\n<p>\u5173\u95ed\u5f53\u524d PowerShell\uff0c\u91cd\u65b0\u6253\u5f00\u4e00\u4e2a\u7a97\u53e3\uff0c\u518d\u6267\u884c\uff1a<\/p>\n<pre><code>Get-Command uv, uvx, uvw -ErrorAction SilentlyContinue\nwhere.exe uv\nwinget list --id astral-sh.uv -e<\/code><\/pre>\n<p>\u7406\u60f3\u7ed3\u679c\u662f\uff1a<\/p>\n<ul>\n<li><code>Get-Command<\/code> \u6ca1\u6709\u8f93\u51fa\uff1b<\/li>\n<li><code>where.exe uv<\/code> \u627e\u4e0d\u5230\u6587\u4ef6\uff1b<\/li>\n<li><code>winget list<\/code> \u4e0d\u518d\u663e\u793a <code>astral-sh.uv<\/code>\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c <code>where.exe uv<\/code> \u4ecd\u7136\u663e\u793a\u8def\u5f84\uff0c\u8bf4\u660e\u5f53\u524d PATH \u6216\u65e7\u6587\u4ef6\u4ecd\u7136\u5b58\u5728\u3002\u4f60\u4e4b\u524d\u672c\u673a\u7684 uv \u8def\u5f84\u662f\uff1a<\/p>\n<pre><code>C:\\Users\\Elite\\.local\\bin\\uv.exe<\/code><\/pre>\n<p>\u91cd\u70b9\u68c0\u67e5\u8fd9\u4e2a\u76ee\u5f55\u3002<\/p>\n<h3>\u91cd\u88c5<\/h3>\n<p>WinGet \u547d\u4ee4\u672c\u8eab\u4e3b\u8981\u8d1f\u8d23\u5b89\u88c5 uv \u5305\uff1buv \u7684\u7f13\u5b58\u3001\u5168\u5c40\u5de5\u5177\u548c Python \u5e76\u4e0d\u4e00\u5b9a\u8ddf\u968f\u5b89\u88c5\u5305\u4f4d\u7f6e\u3002\u5b98\u65b9 uv \u5b89\u88c5\u5668\u652f\u6301\u901a\u8fc7 <code>UV_INSTALL_DIR<\/code> \u4fee\u6539\u4e8c\u8fdb\u5236\u5b89\u88c5\u76ee\u5f55\uff0c\u4f46\u8fd9\u53ea\u5f71\u54cd uv \u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4e0d\u4f1a\u81ea\u52a8\u8fc1\u79fb\u7f13\u5b58\u3001Python \u548c\u5de5\u5177\u76ee\u5f55\u3002(<a href=\"https:\/\/docs.astral.sh\/uv\/reference\/installer\/\">docs.astral.sh<\/a>)<\/p>\n<p>\u5982\u679c\u4f60\u7684\u76ee\u6807\u662f\u5b8c\u6574\u8fc1\u79fb\u5230 D \u76d8\uff0c\u5efa\u8bae\u6e05\u7406\u540e\u4f7f\u7528\u5b98\u65b9\u5b89\u88c5\u5668\uff1a<\/p>\n<pre><code>powershell -ExecutionPolicy Bypass -Command {\n    $env:UV_INSTALL_DIR = \"D:\\tools\\uv\"\n    irm https:\/\/astral.sh\/uv\/install.ps1 | iex\n}<\/code><\/pre>\n<p>\u518d\u628a\u6570\u636e\u76ee\u5f55\u8bbe\u7f6e\u5230 D \u76d8\uff1a<\/p>\n<pre><code>[Environment]::SetEnvironmentVariable(\n    \"UV_CACHE_DIR\",\n    \"D:\\tools\\uv-cache\",\n    \"User\"\n)\n\n[Environment]::SetEnvironmentVariable(\n    \"UV_TOOL_DIR\",\n    \"D:\\tools\\uv-tools\",\n    \"User\"\n)\n\n[Environment]::SetEnvironmentVariable(\n    \"UV_PYTHON_INSTALL_DIR\",\n    \"D:\\tools\\uv-python\",\n    \"User\"\n)<\/code><\/pre>\n<p>\u91cd\u65b0\u6253\u5f00 PowerShell \u540e\u68c0\u67e5\uff1a<\/p>\n<pre><code>uv --version\nuv cache dir\nuv tool dir\nuv python dir<\/code><\/pre>\n<h3>\u4fee\u6539\u6210\u529f<\/h3>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.imgbed.kdns.fr\/test\/image-20260723132113230.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"https:\/\/www.imgbed.kdns.fr\/test\/image-20260723132113230.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"image-20260723132113230\" \/><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UV\u5378\u8f7d\u91cd\u88c5 \u9ed8\u8ba4\u88c5c\u76d8\u5360\u7a7a\u95f4\u592a\u591a windows\u73af\u5883 \u5b8c\u6574\u5220\u9664\u5efa\u8bae \u5148\u5728\u4ecd\u80fd\u4f7f\u7528 uv \u7684 PowerShe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-242","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/posts\/242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/comments?post=242"}],"version-history":[{"count":0,"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/posts\/242\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/media?parent=242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/categories?post=242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.notiq.cn\/index.php\/wp-json\/wp\/v2\/tags?post=242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}