Zsh: lệnh không tìm thấy python Ubuntu

Có thể có nhiều lý do có thể gây ra zsh. lệnh không tìm thấy. python khi bạn cố chạy chương trình Python trên Mac Terminal. Một trong những lý do phổ biến nhất là bạn đã cài đặt Python3 trên máy Mac của mình

Zsh: lệnh không tìm thấy python Ubuntu


Sửa lỗi 1. Sử dụng Python3 thay vì Python

% python3
Python 3.9.6 (default, Aug  5 2022, 15:21:02) 
[Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Sửa lỗi 2. Cài đặt Python bằng brew

Nếu vẫn thiếu Python, hãy cài đặt Python bằng trình quản lý gói Homebrew cho Mac,

% brew install python

sửa lỗi 3. Đường dẫn Python không được đặt

Bạn có thể đã cài đặt Python nhưng đường dẫn chưa được đặt. Cập nhật đường dẫn trong. tập tin zshrc

-



Có một vài câu hỏi?
Vui lòng kích hoạt JavaScript để xem các bình luận được cung cấp bởi Disqus

Thêm bài viết liên quan đến Python,

  • Nhận xét trong lập trình Python
  • tkinter - Xin chào thế giới. Chương trình
  • Cách cài đặt Python3. 11 trên Mac
  • Lỗi phân đoạn matplotlib Python. 11 macOS Big Sur
  • Thay đổi màu nhãn (văn bản) trong tkinter
  • Python Xin chào thế giới. Chương trình với mã ví dụ (đoạn mã)
  • Tính số tiền chiết khấu mã python
  • Lấy đối số đầu vào từ dòng lệnh trong Lập trình Python
  • Cách pip cài đặt Mô-đun Python trong VSCode
  • Tkinter - thêm phần đệm x và y vào văn bản nhãn
  • Lỗi tăng Python với ví dụ về thông báo
  • Kiểm tra xem chuỗi có chứa chuỗi con không - Python
  • Chương Trình Python Tính Lãi Đơn (Simple Interest. py)
  • Tiền tố b trước Chuỗi có nghĩa là gì trong Python?
  • Vận tốc đầu cuối và công thức của nó là gì?
  • Cách liệt kê tất cả các Gói được cài đặt bằng pip [Python]
  • Chuyển đổi Float thành String trong Python
  • Thay đổi nền của nhãn hoặc văn bản Tkinter
  • Cách cài đặt các mô-đun Python trong Mã VS
  • Mã Python thụt lề trong Notepad ++
  • Xác thực địa chỉ email trong Python bằng biểu thức chính quy (regex)
  • con trăn. Sửa lệnh không tìm thấy pip hoặc pip3 trên vỏ zsh
  • LoạiLỗi. phải là str, không phải int [Fix Python]
  • ModuleNotFoundLỗi. Không có mô-đun nào có tên qdarkstyle. hệ màu [Python]
  • Python - Chuyển đổi float thành String

Bài viết khác

  • Cách cập nhật Mục danh sách SharePoint theo chương trình bằng C#. Mạng - SharePoint
  • API ngày giờ Java. Các ví dụ về LocalDateTime get (Trường TemporalField) - Java
  • 🔥 [BTS ARMY] Các hashtag #ExaBLINK, #ExaARMY đang thịnh hành trên toàn thế giới - BTS
  • Làm thế nào để biết ai đó đã đọc tin nhắn WhatsApp của bạn - WhatsApp
  • Lệnh kiểm tra Lịch sử đăng nhập hoặc khởi động lại lần cuối của người dùng và TTY - Linux
  • Cách cài đặt các mô-đun Python trong mã VS - Python
  • Cách tích hợp Dịch vụ và Bán hàng CRM của Salesforce với Microsoft Teams - Teams
  • Ví dụ về Struts 2 Hello World trong Eclipse - Java

Trong bài viết này, chúng ta sẽ xem cách giải zsh. lệnh không tìm thấy. lỗi pip nếu bạn cũng gặp lỗi này trong hệ thống Linux/macOS của mình. Vài ngày khi tôi đang cố gắng cài đặt gói python trong Hệ thống của mình bằng tiện ích pip thì tôi đột nhiên nhận thấy zsh. lệnh không tìm thấy. lỗi pip trên đầu ra. Mặc dù đây là một lỗi rất phổ biến mà nhiều người mới bắt đầu sử dụng python và các chuyên gia gặp phải do nhiều lý do khác nhau nhưng trong trường hợp của tôi, đó là do tôi đã cài đặt phiên bản pip mới nhất trong hệ thống của mình. e pip3 nhưng tôi đang cố sử dụng lệnh pip cũ hơn

Vì vậy, tôi nghĩ rằng có rất nhiều người ngoài kia đang thắc mắc tại sao zsh. lệnh không tìm thấy. lỗi pip bật lên ngay cả khi họ đã cài đặt tiện ích pip trong hệ thống của họ hoặc trong hầu hết các trường hợp, nó có thể không được cài đặt. Đối với tất cả những trường hợp đó, bạn nên viết một bài viết giải thích các bước cần thực hiện trên các hệ thống phân phối Linux và macOS khác nhau để khắc phục lỗi này. Vì vậy, không chậm trễ hơn nữa, hãy bắt đầu

 

Zsh: lệnh không tìm thấy python Ubuntu

Đã giải quyết "zsh. lệnh không tìm thấy. píp" trong Linux/macOS

Cũng đọc. Cách POST dữ liệu JSON bằng cách sử dụng curl (2 phương pháp tốt nhất)

pip là trình quản lý gói python rất nổi tiếng và được sử dụng phổ biến nhất để cài đặt, quản lý và xóa các gói python khỏi Hệ thống. Hầu như tất cả các nhà phát triển và lập trình viên python đều sử dụng tiện ích này để dễ dàng quản lý các gói python của họ. Đôi khi điều đó xảy ra là bất cứ khi nào chúng tôi cố gắng sử dụng pip để thực hiện một số thao tác quản lý gói nhất định thì chúng tôi sẽ nhận được zsh. lệnh không tìm thấy. lỗi pip như hình bên dưới

ubuntu% pip --version
zsh: command not found: pip

Mặc dù lỗi trên có thể do bất kỳ lý do nào nhưng hầu hết là do tiện ích python hoặc pip chưa được cài đặt trong Hệ thống Linux/macOS hoặc nếu nó được cài đặt thì bạn có phiên bản pip mới nhất. e pip3 thay vì pip. Vì vậy, tùy thuộc vào hệ thống bạn đang sử dụng, bạn có thể thử các phương pháp khác nhau bên dưới để xử lý lỗi

 

Phương pháp 1. Sử dụng tiện ích brew

Nếu bạn đang sử dụng hệ thống Linux có trình quản lý gói brew hoặc bạn đang sử dụng hệ thống dựa trên macOS thì bạn có thể thử phương pháp này để sửa lỗi. Bạn chỉ cần cài đặt gói python bằng cách sử dụng lệnh

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
1 như hình bên dưới. Điều này sẽ cài đặt phiên bản python mới nhất có sẵn tôi. e python3 và cùng với nó là tiện ích pip có sẵn mới nhất tôi. ống3

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

 

Phương pháp 2. Sử dụng apt hoặc apt-get

Nếu bạn đang sử dụng bất kỳ hệ thống dựa trên Ubuntu/Debian/Linux Mint nào, thì bạn có thể thử phương pháp này khi bạn chỉ cần chạy lệnh

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
2 để cài đặt tiện ích
ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
3 nếu bạn đang sử dụng phiên bản python mới nhất i. con trăn3. Trong trường hợp, bạn đang sử dụng phiên bản cũ hơn tôi. e python2 thì bạn cần chạy lệnh
ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
4

quảng cáo

________số 8_______

 

Phương pháp 3. Sử dụng Tập lệnh Python

Bạn cũng có tùy chọn cài đặt tiện ích pip thông qua Python Script. Nhưng để làm được điều đó, bạn nên có sẵn tiện ích wget trong Hệ thống của mình. Sau đó, bạn chỉ cần chạy lệnh

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
5 để tải xuống tập lệnh python trong hệ thống cục bộ của mình

ubuntu% wget https://bootstrap.pypa.io/get-pip.py
--2022-12-10 18:59:36-- https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io).. 199.232.104.175, 2a04:4e42:5a::175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|199.232.104.175|:443.. connected.
HTTP request sent, awaiting response.. 200 OK
Length: 2569500 (2.5M) [text/x-python]
Saving to: ‘get-pip.py’

get-pip.py 100%[============================================================================>] 2.45M 7.50MB/s in 0.3s

2022-12-10 18:59:36 (7.50 MB/s) - ‘get-pip.py’ saved [2569500/2569500]

Bây giờ để cài đặt tiện ích, bạn cần chạy tập lệnh python bằng cách sử dụng

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
6 như hình bên dưới. Trong trường hợp, bạn đang sử dụng phiên bản python cũ hơn tôi. e python2 thì bạn cần dùng lệnh
ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
7

ubuntu% python3 get-pip.py
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Downloading pip-22.3.1-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.7 MB/s eta 0:00:00
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.8 are installed in '/home/cyberithub/.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-22.3.1

 

Phương pháp 4. Sử dụng tiện ích dnf

Nếu bạn đang sử dụng bất kỳ hệ thống mới nhất dựa trên RHEL/CentOS nào đã cài đặt phiên bản python mới nhất, thì bạn có thể cài đặt tiện ích pip bằng cách sử dụng lệnh

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
8 như hình bên dưới. Trong trường hợp, bạn đang sử dụng phiên bản python cũ hơn tôi. e python2 thì bạn cần chạy lệnh
ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
9

[cyberithub@centos8]~% sudo dnf install python3-pip
Last metadata expiration check: 0:00:15 ago on Sat 10 Dec 2022 09:01:52 AM EST.
Dependencies resolved.
=============================================================================================================================================================
Package Architecture Version Repository Size
=============================================================================================================================================================
Installing:
python3-pip noarch 9.0.3-20.el8 appstream 20 k
Installing dependencies:
python36 x86_64 3.6.8-38.module_el8.5.0+895+a459eca8 appstream 19 k

Transaction Summary
=============================================================================================================================================================
Install 2 Packages

Total download size: 39 k
Installed size: 16 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): python3-pip-9.0.3-20.el8.noarch.rpm 107 kB/s | 20 kB 00:00
(2/2): python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64.rpm 102 kB/s | 19 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 198 kB/s | 39 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64 1/2
Running scriptlet: python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64 1/2
Installing : python3-pip-9.0.3-20.el8.noarch 2/2
Running scriptlet: python3-pip-9.0.3-20.el8.noarch 2/2
Verifying : python3-pip-9.0.3-20.el8.noarch 1/2
Verifying : python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64 2/2

Installed:
python3-pip-9.0.3-20.el8.noarch python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64

Complete!

Sau khi làm theo các phương pháp trên, bây giờ nếu bạn kiểm tra lại bằng cách sử dụng lệnh

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
0, thì bạn sẽ thấy tiện ích pip khả dụng

ubuntu% pip3 --version
pip 22.2.2 from /home/linuxbrew/.linuxbrew/opt/[email protected]/lib/python3.10/site-packages/pip (python 3.10)

Trong trường hợp bạn không thoải mái khi sử dụng lệnh pip3 thì bạn có thể tạo bí danh của pip3 và sử dụng lệnh pip. Để làm được điều đó, trước tiên bạn cần xác định đường dẫn của tiện ích nhị phân pip3 bằng cách sử dụng lệnh

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
1 như hình bên dưới

ubuntu% which pip3
/home/cyberithub/.local/bin/pip3

Sau đó thêm đường dẫn trên làm bí danh cho tiện ích pip trong tệp

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
2 như hình bên dưới

ubuntu% nano ~/.zshrc
alias pip='/home/cyberithub/.local/bin/pip3'

Nhấn

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
3 để lưu và thoát. Bây giờ hãy thử chạy lệnh
ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
4. Bạn sẽ nhận thấy rằng nó sẽ bắt đầu hoạt động như mong đợi

ubuntu% pip --version
pip 22.3.1 from /home/cyberithub/.local/lib/python3.8/site-packages/pip (python 3.8)

Ngay cả sau khi làm theo các phương pháp trên, nếu bạn vẫn gặp lỗi

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
5 thì có thể là do bạn đã cài đặt tiện ích ở một số vị trí mà Hệ thống không nhìn thấy được. Vì vậy, để hiển thị nó, bạn cần thêm đường dẫn cài đặt vào biến môi trường toàn cầu
ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
6 như hình bên dưới

ubuntu% brew install python
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.8-1
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/d4e394cc5e1801239d2f498385a78f2f7b8cf39ba249179edb256c978697bc1b--python@3.10-3.10.8-1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:2e0127173d003685094f79bf5f94652f66af803643cc89ae5dca0a5af8342e47
Already downloaded: /home/cyberithub/.cache/Homebrew/downloads/880b6a13efaeb607fcafb898401e34e08762b0105fbe8da9d690e853aeb6f12f--python@3.10--3.10.8.x86_64_linux.bottle.1.tar.gz
==> Pouring [email protected]_64_linux.bottle.1.tar.gz
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m ensurepip
==> /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8/bin/python3.10 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/home/linuxbrew/
==> Caveats
Python has been installed as
/home/linuxbrew/.linuxbrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/home/linuxbrew/.linuxbrew/opt/[email protected]/libexec/bin

You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/home/linuxbrew/.linuxbrew/lib/python3.10/site-packages

tkinter is no longer included with this formula, but it is available separately:
brew install [email protected]

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /home/linuxbrew/.linuxbrew/Cellar/[email protected]/3.10.8: 2,667 files, 59.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
0

Tuy nhiên bước trên chỉ là tạm thời. Để thực hiện các thay đổi vĩnh viễn, bạn cần đưa một mục nhập vào tệp

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
7 hoặc
ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
8

Hy vọng rằng các giải pháp trên sẽ đủ để giải quyết lỗi

ubuntu% sudo apt install python3-pip
Reading package lists.. Done
Building dependency tree
Reading state information.. Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-setuptools python3-wheel python3.8-dev zlib1g-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev python3-distutils python3-pip python3-setuptools python3-wheel python3.8-dev
zlib1g-dev
0 upgraded, 11 newly installed, 0 to remove and 28 not upgraded.
Need to get 7,274 kB of archives.
After this operation, 28.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libexpat1-dev amd64 2.2.9-1ubuntu0.6 [116 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [3,949 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu focal/main amd64 libpython3-dev amd64 3.8.2-0ubuntu2 [7,236 B]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python-pip-whl all 20.0.2-5ubuntu1.6 [1,805 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 zlib1g-dev amd64 1:1.2.11.dfsg-2ubuntu1.5 [155 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-dev amd64 3.8.10-0ubuntu1~20.04.6 [514 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 python3-distutils all 3.8.10-0ubuntu1~20.04 [141 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-dev amd64 3.8.2-0ubuntu2 [1,212 B]
Get:9 http://in.archive.ubuntu.com/ubuntu focal/main amd64 python3-setuptools all 45.2.0-1 [330 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:11 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Fetched 7,274 kB in 3s (2,198 kB/s)
Selecting previously unselected package libexpat1-dev:amd64.
(Reading database .. 203905 files and directories currently installed.)
Preparing to unpack .../00-libexpat1-dev_2.2.9-1ubuntu0.6_amd64.deb ...
Unpacking libexpat1-dev:amd64 (2.2.9-1ubuntu0.6) ...
Selecting previously unselected package libpython3.8-dev:amd64.
5. Vui lòng cho tôi biết phản hồi của bạn trong hộp bình luận

Làm cách nào để chạy python với zsh?

Thật may là sự cố này rất dễ khắc phục. .
Bước 1. đảm bảo Python đã được cài đặt. Điều đầu tiên bạn nên kiểm tra là python đã được cài đặt chưa. .
Bước 2. thêm trăn vào zsh. Bước tiếp theo là thêm python vào zsh để nó chạy khi gõ lệnh python. .
Bước 3. khởi động lại thiết bị đầu cuối

Con trăn nào nói không tìm thấy con trăn?

Lỗi này có nghĩa là Python chưa được cài đặt hoặc cài đặt của bạn bị hỏng bao gồm cài đặt $PATH sai .

Làm cách nào để sử dụng python trong thiết bị đầu cuối Ubuntu?

Mở cửa sổ terminal và nhập 'python' (không có dấu ngoặc kép) . Điều này sẽ mở python ở chế độ tương tác. Mặc dù chế độ này tốt cho việc học ban đầu, nhưng bạn có thể thích sử dụng trình soạn thảo văn bản hơn (như Gedit, Vim hoặc Emacs) để viết mã của mình.

Làm cách nào để cài đặt pip trong python Ubuntu?

pip3 là trình cài đặt gói chính thức cho Python 3. Nó có thể được sử dụng để cài đặt các gói từ Python Package Index. .
Bước 1 - Cập nhật hệ thống. Bạn nên cập nhật trước khi thử cài đặt gói mới. .
Bước 2 - Cài đặt pip3. .
Bước 3 - Xác minh