GNU/Linux >> Linux の 問題 >  >> Linux

RockyLinux8にPIPPythonPackageManagerをインストールして使用する方法

Pythonは、世界中の開発者が使用する汎用の高級プログラミング言語です。 PIPは、追加のパッケージのインストールと管理に使用されるPythonのパッケージマネージャーです。 PIPを使用すると、パッケージの完全なリストとそれに対応するバージョン番号を管理できます。 PIPは、setup.pyファイルを使用してユーザー定義プロジェクトをローカルにインストールする方法を提供します。

この投稿では、RockyLinux8にPIPをインストールして使用する方法について説明します。

前提条件

  • Atlantic.NetクラウドプラットフォームでRockyLinux8を実行しているサーバー
  • サーバーで構成されているrootパスワード

ステップ1-Atlantic.Netクラウドサーバーを作成する

まず、Atlantic.Netクラウドサーバーにログインします。 2GB以上のRAMを搭載したオペレーティングシステムとしてRockyLinux8を選択して、新しいサーバーを作成します。 SSH経由でクラウドサーバーに接続し、ページの上部で強調表示されているクレデンシャルを使用してログインします。

サーバーにログインしたら、次のコマンドを実行して、ベースシステムを最新の利用可能なパッケージで更新します。

dnf update -y

ステップ2– RockyLinux8にPIPをインストールする

PIPをインストールする前に、システムにPythonをインストールする必要があります。次のコマンドを実行してインストールできます:

dnf install python39 -y

Pythonをインストールしたら、次のコマンドを使用してPythonのバージョンを確認できます。

python3.9 --version

次の出力が得られるはずです:

Python 3.9.2

次に、次のコマンドを使用してPIPをインストールします。

dnf install python39-pip

PIPがインストールされたら、次のコマンドを使用して、インストールされているPIPのバージョンを確認します。

pip3 --version

次の出力が表示されます。

pip 20.2.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)

ステップ3–PIPを更新する方法

PIPを最新バージョンに更新することをお勧めします。次のコマンドを使用して更新できます:

pip3 install --upgrade pip

次の出力が表示されます。

Collecting pip
  Downloading pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 1.9 MB/s 
Installing collected packages: pip
Successfully installed pip-21.3.1

これで、次のコマンドを使用してPIPバージョンを確認できます。

pip3 --version

次の出力が表示されます。

pip 21.3.1 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

ステップ4–PIPの使用方法

次のコマンドを使用して、PIPで使用可能なすべての重要なオプションを一覧表示できます。

pip3 --help

次の出力が表示されます。

Usage:   
  pip3  [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.
  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.

特定のパッケージをインストールするには、次のコマンドを実行します。

pip3 install wheel

パッケージに関する詳細情報を取得するには、次のコマンドを実行します。

pip3 show wheel

次の出力が得られます:

Name: wheel
Version: 0.37.0
Summary: A built-package format for Python
Home-page: https://github.com/pypa/wheel
Author: Daniel Holth
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.9/site-packages
Requires: 
Required-by: 

インストールされているすべてのパッケージを一覧表示するには、次のコマンドを実行します。

pip3 list

次の出力が表示されます。

Package    Version
---------- -------
pip        21.3.1
setuptools 50.3.2
wheel      0.37.0

古いパッケージをすべて一覧表示するには、次のコマンドを実行します。

pip3 list --outdated

次の出力が表示されます。

Package    Version Latest Type
---------- ------- ------ -----
setuptools 50.3.2  58.5.3 wheel

特定のパッケージをアンインストールするには、次のコマンドを実行します。

pip3 uninstall wheel

結論

上記の投稿では、Rocky Linux 8にPIPをインストールして使用する方法を学びました。また、PIPを使用してPythonパッケージを管理する方法も学びました。 PIPを使用してPythonの依存関係を簡単に管理できるようになりました。 Atlantic.NetからVPSホスティングを始めましょう!


Linux
  1. Debian11にPIPPythonPackageManagerをインストールして使用する方法

  2. LinuxでYarnPackageManagerをインストールして使用する方法

  3. LinuxでFlatpakをインストールして使用する方法

  1. AlmaLinux8にSnapPackageManagerをインストールして使用する方法

  2. LinuxでTracerouteをインストールして使用する方法

  3. RockyLinux8にPython3.10をインストールする方法

  1. Linux Screenをインストールして使用する方法は?

  2. LinuxにPuTTYをインストールして使用する方法

  3. OracleLinux8にYarnNPMPackageManagerをインストールする方法