Python 使用套件管理工具 uv 和 pip 安裝套件時,預設會在本地保存快取,之後安裝到相同套件,則不用再次下載,若已用不到快取,可刪除快取釋放空間。
pip | uv | |
---|---|---|
版本 | > py -m pip -V pip 24.3.1 from C:\Users\xyz\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip (python 3.13) | > uv version uv 0.5.27 (73e9928d4 2025-02-03) |
查看快取資料夾路徑 | > py -m pip cache dir c:\users\xyz\appdata\local\pip\cache |
> uv cache dir C:\Users\xyz\AppData\Local\uv\cache 預設路徑 macOS and Linux:`$XDG_CACHE_HOME/uv` 或 `$HOME/.cache/uv` Windows: `%LOCALAPPDATA%\uv\cache` |
快取資訊 | > py -m pip cache info Package index page cache location (pip v23.3+): c:\users\xyz\appdata\local\pip\cache\http-v2 Package index page cache location (older pips): c:\users\xyz\appdata\local\pip\cache\http Package index page cache size: 0 bytes Number of HTTP files: 0 Locally built wheels location: c:\users\xyz\appdata\local\pip\cache\wheels Locally built wheels size: 2.3 kB Number of locally built wheels: 0 |
|
快取列表 | > py -m pip cache list [<pattern>] [--format=[human, abspath]] <pattern>:glob expression 或 package name > py -m pip cache list No locally built wheels cached. |
|
移除指定快取 | > py -m pip cache remove <pattern> <pattern>:glob expression 或 package name > py -m pip cache remove aa WARNING: No matching packages for pattern "aa" Files removed: 0 |
|
清除快取 | > py -m pip cache purge | > uv cache clean Clearing cache at: AppData\Local\uv\cache Removed 119321 files (5.9GiB) 會刪除整個快取資料夾 |
刪除沒用到的快取 | > uv cache prune Pruning cache at: AppData\Local\uv\cache Removed 272417 files (12.6GiB) |
|
Cache Options | --format <list_format> Select the output format among: human (default) or abspath 相關: 安裝時不保存使用快取 py -m pip install --no-cache-dir <package> |
-n, --no-cache Avoid reading from or writing to the cache, instead using a temporary directory for the duration of the operation [env: UV_NO_CACHE=] --cache-dir <CACHE_DIR> Path to the cache directory. Defaults to `$XDG_CACHE_HOME/uv` or `$HOME/.cache/uv` on macOS and Linux, and `%LOCALAPPDATA%\uv\cache` on Windows. [env: UV_CACHE_DIR=] |
沒有留言:
張貼留言