最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用uv安裝python任意版本的命令詳解(uv?python?install)

 更新時(shí)間:2025年08月27日 10:50:25   作者:skywalk8163  
uv是一個(gè)超快速的Python包安裝器和解析器,用Rust編寫,是pip、pip-tools和virtualenv的高速替代品,這篇文章主要介紹了使用uv安裝python任意版本命令(uv?python?install)的相關(guān)資料,需要的朋友可以參考下

使用uv安裝python任意版本

先使用uv看看可以裝哪些版本

輸出: 

uv python list
cpython-3.14.0a5+freethreaded-linux-x86_64-gnu    <download available>
cpython-3.14.0a5-linux-x86_64-gnu                 <download available>
cpython-3.13.2+freethreaded-linux-x86_64-gnu      <download available>
cpython-3.13.2-linux-x86_64-gnu                   <download available>
cpython-3.12.9-linux-x86_64-gnu                   py312/bin/python3.12
cpython-3.12.9-linux-x86_64-gnu                   py312/bin/python3 -> python3.12
cpython-3.12.9-linux-x86_64-gnu                   py312/bin/python -> python3.12
cpython-3.12.9-linux-x86_64-gnu                   <download available>
cpython-3.11.11-linux-x86_64-gnu                  <download available>
cpython-3.10.16-linux-x86_64-gnu                  <download available>
cpython-3.10.12-linux-x86_64-gnu                  /usr/bin/python3.10
cpython-3.10.12-linux-x86_64-gnu                  /usr/bin/python3 -> python3.10
cpython-3.10.12-linux-x86_64-gnu                  /bin/python3.10
cpython-3.10.12-linux-x86_64-gnu                  /bin/python3 -> python3.10
cpython-3.9.21-linux-x86_64-gnu                   <download available>
cpython-3.8.20-linux-x86_64-gnu                   <download available>
cpython-3.7.9-linux-x86_64-gnu                    <download available>
pypy-3.11.11-linux-x86_64-gnu                     <download available>
pypy-3.10.19-linux-x86_64-gnu                     <download available>
pypy-3.9.19-linux-x86_64-gnu                      <download available>
pypy-3.8.16-linux-x86_64-gnu                      <download available>
pypy-3.7.13-linux-x86_64-gnu                      <download available>

安裝python3.9版本

uv python install 3.9

速度有點(diǎn)慢...安裝完成,用uv python list來(lái)看一下:

cpython-3.9.21-linux-x86_64-gnu                   /home/skywalk/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/bin/python3.9

臨時(shí)添加到路徑

# 臨時(shí)添加路徑(關(guān)閉終端后失效)
export PATH="$HOME/.local/share/uv/python/cpython-3.9.21-linux-x86_64-gnu/bin:$PATH"

# 驗(yàn)證
python  --version  # 

好的,證明現(xiàn)在就是python3.9了:

python  --version  #
Python 3.9.21

永久添加到 PATH‌

  • 步驟‌:編輯 ~/.bashrc、~/.zshrc 或 ~/.bash_profile
  • echo 'export PATH="$HOME/.local/share/uv/python/3.10.12/bin:$PATH"' >> ~/.bashrc
  • 執(zhí)行 source ~/.bashrc 生效

不行,換方法

 創(chuàng)建python3.9虛擬環(huán)境

uv venv py39

source py39/bin/activate

還是不行

現(xiàn)在只能用這個(gè)方法,加參數(shù):--break-system-packages

pip install pip -U --break-system-packages

測(cè)試的時(shí)候這樣用

安裝測(cè)試庫(kù)

pip install -e ".[testing]" --break-system-packages

 測(cè)試

pytest

調(diào)試

pip install的時(shí)候報(bào)錯(cuò)This Python installation is managed by uv and should not be modified.

pip install -e ".[testing]"

[notice] A new release of pip is available: 24.3.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
error: externally-managed-environment

× This environment is externally managed
╰─> This Python installation is managed by uv and should not be modified.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

搞不定,只好創(chuàng)建虛擬環(huán)境

uv venv py39

source py39/bin/activate
 uv venv py39
Using CPython 3.9.21
Creating virtual environment at: py39
Activate with: source py39/bin/activate
(base) skywalk@ubuntu22win:~$ source py39/bin/activate

總結(jié) 

到此這篇關(guān)于使用uv安裝python任意版本命令的文章就介紹到這了,更多相關(guān)uv安裝python任意版本命令內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

莒南县| 济南市| 卢湾区| 浙江省| 孝昌县| 皋兰县| 法库县| 武宁县| 神木县| 秦安县| 青河县| 刚察县| 大英县| 闽侯县| 五常市| 三河市| 东海县| 商河县| 望奎县| 金寨县| 建德市| 宁乡县| 安丘市| 靖州| 叙永县| 尚志市| 项城市| 内丘县| 宁蒗| 张掖市| 铜梁县| 柯坪县| 敖汉旗| 奉贤区| 元朗区| 诸城市| 司法| 淮安市| 旬邑县| 潼关县| 沂水县|