1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Python 仮想環境 手順

Last updated at Posted at 2021-07-02

作成

フォルダ階層

projectdir
   ├── venv
   │     └── venvの諸々のファイル
   ├── main.py
   └── requirements.txt

作成からアクティベートまで

たーみなる
$ mkdir projectdir
$ cd projectdir
$ python3 -m venv venv
$ source venv/bin/activate 

requirements.txt

ここに書かれているのを元にpip installしてくれる凄いやつ
名前はなんでもいいらしいけど

  • 元の環境でいろいろ入れている人はpip freezeコマンド打って出てきたやつから入れたいの選んでをコピペでOK
  • 元の環境と全て同じにしたいのであればpip freeze > requirements.txtでOK
たーみなる
$ pip freeze
or 
$ pip freeze > requirements.txt

requirements.txt
Flask==1.1.2
pandas==1.2.4

書けたらインストールしてpip freezeで確認

たーみなる
$ pip install -r requirements.txt

$ pip freeze
1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?