2023年3月25日 星期六

[研究]pip 22.0.2 (軟體包管理系統) 安裝,升級到 23.0.1 (Ubuntu 22.04.2 LTS)

[研究]pip 22.0.2 (軟體包管理系統) 安裝,升級到 23.0.1 (Ubuntu 22.04.2 LTS)

2023-03-25

Pip (軟體包管理系統) - 維基百科,自由的百科全書
https://zh.wikipedia.org/zh-tw/Pip_(%E8%BB%9F%E4%BB%B6%E5%8C%85%E7%AE%A1%E7%90%86%E7%B3%BB%E7%B5%B1)

pip是一個以Python電腦程式語言寫成的軟體包管理系統,他可以安裝和管理軟體包,另外不少的軟體包也可以在「Python軟體包索引」(英語:Python Package Index,PyPI)中找到。許多Python的發行版中已經預裝了pip。

********************************************************************************

安裝,簡單來說就是2行指令

sudo apt-get -y update  (這個更新非必須,但以實測結果而言,不更新,pip無法安裝成功)
sudo apt-get -y install pip

實際安裝情況

user1@ubuntu22042:~$ apt-cache policy pip
pip:
  Installed: (none)
  Candidate: (none)
  Version table:

user1@ubuntu22042:~$ sudo apt-get -y install pip
...(略)
Err:45 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 libpython3.10-dev amd64 3.10.6-1~22.04.2
  404  Not Found [IP: 140.110.240.80 80]
Err:48 http://security.ubuntu.com/ubuntu jammy-updates/main amd64 python3.10-dev amd64 3.10.6-1~22.04.2
  404  Not Found [IP: 140.110.240.80 80]
Fetched 56.9 MB in 12s (4874 kB/s)                                                           
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.10/libpython3.10-dev_3.10.6-1%7e22.04.2_amd64.deb  404  Not Found [IP: 140.110.240.80 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/python3.10/python3.10-dev_3.10.6-1%7e22.04.2_amd64.deb  404  Not Found [IP: 140.110.240.80 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

user1@ubuntu22042:~$ sudo apt-get -y update
...(略)

user1@ubuntu22042:~$ sudo apt-get -y install pip
Processing triggers for man-db (2.10.2-1) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ... user1@ubuntu22042:~$ pip -V pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10) user1@ubuntu22042:~$ pip Usage: pip <command> [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. cache Inspect and manage pip's wheel cache. index Inspect information available from package indexes. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands. General Options: -h, --help Show help. --debug Let unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. --require-virtualenv Allow pip to only run in a virtual environment; exit with an error otherwise. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log <path> Path to a verbose appending log. --no-input Disable prompting for input. --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port. --retries <retries> Maximum number of retries each connection should attempt (default 5 times). --timeout <sec> Set the socket timeout (default 15 seconds). --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort. --trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS. --cert <path> Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information. --client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir <dir> Store the cache data in <dir>. --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output. --no-python-version-warning Silence deprecation warnings for upcoming unsupported Pythons. --use-feature <feature> Enable new functionality, that may be backward incompatible. --use-deprecated <feature> Enable deprecated functionality, that will be removed in the future. user1@ubuntu22042:~$

常用的就是 install。

更新 pip 的可安裝套件列表

user1@ubuntu22042:~$ pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /usr/lib/python3/dist-packages (22.0.2)
Collecting pip
  Downloading pip-23.0.1-py3-none-any.whl (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 3.9 MB/s eta 0:00:00
Installing collected packages: pip
  WARNING: The scripts pip, pip3 and pip3.10 are installed in '/home/user1/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-23.0.1

user1@ubuntu22042:~$ pip -V
pip 23.0.1 from /home/user1/.local/lib/python3.10/site-packages/pip (python 3.10)
user1@ubuntu22042:~$ 

(完)

相關

[研究]pip 21.2.3 (軟體包管理系統) 安裝 (Ubuntu 22.04.2 LTS)
https://shaurong.blogspot.com/2023/03/pip-2202-ubuntu-22042-lts.html

[研究]Pip 21.2.3 (軟體包管理系統) 安裝 (Rocky Linux 9.1)
https://shaurong.blogspot.com/2023/03/pip-2123-rocky-linux-91.html

沒有留言:

張貼留言