LoginSignup
3
2

More than 1 year has passed since last update.

pip freezeして、パッケージを管理する

Posted at

前提

この記事でわかること: python におけるパッケージの管理方法
pythonのバージョン: Python 3.10.0

pythonでのパッケージ管理はpipを使う

pipコマンド でパッケージをインストール/アンインストールができます。

// pip でインストール
pip install <package>

// requirements.txtを指定してパッケージをインストール
pip install -r requirements.txt

逆に今インストールされているパッケージをrequirements.txtに書き出すときは、pip freezeを使います。

pip freeze > requirements.txt

補足

他のプログラミング言語でのパッケージ管理と管理するファイルをまとめておきます。

プログラミング言語 コマンド ファイル
Python pip requirements.txt
Ruby gem Gemfile
PHP composer composer.jso

経緯

django + Cloud Run + Cloud Sqlでアプリを個人開発するときに、pythonにおけるパッケージの管理がわからなかったので、調べました。
普段はPHPを使うことが多く、pythonは初めてだったのでまた一つ賢くなれました。

参考URL

pip: Python環境構築ガイド -python.jp

Python, pipでrequirements.txtを使ってパッケージ一括インストール | note.nkmk.me

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2