LoginSignup
0
0

More than 3 years have passed since last update.

Python仮想環境作成コマンド

Last updated at Posted at 2020-01-14

仮想環境とは

開発するアプリケーションによっては特定のバージョンのソフトウェアを使いたいといったシチュエーションが出てくることがあります。そこで一般的には、他の開発環境から独立した環境で開発作業を進めることになります。それが仮想環境です。Pythonには標準パッケージとして"venv"というものが組み込まれているのでそちらを使っていきます。

動作環境

Windows10
Python 3.8.1
Pycharm 2019.3.1 Community Edition (最強のPython IDE)
image.png

仮想環境の作成

PycharmのTerminalでpythonが動く事を確認したら下のコマンドを入力

terminal
python -m venv <ディレクトリ名>

今回はそのまま"venv"というディレクトリ名で作成します。
すると、このように仮想環境ディレクトリがあっという間に作成されます。
image.png

それでは仮想環境を起動してみましょう。

terminal
venv\Scripts\activate

image.png

Pycharmを再起動しても自動的に仮想環境に入っているので毎日の開発作業も楽ちんです!
image.png

当然Pythonも使えます。
このままDjangoプロジェクトでも始めてみては如何でしょうか?('ω')

PycharmでDangoプロジェクトをサーバー起動するまでの設定

終わり

0
0
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
0
0