0
2

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 1 year has passed since last update.

Anaconda環境でFlaskを動かす

Posted at

Anacondaの仮想環境作成~Flaskのインストール

仮想環境を作る

名前は "senerio" とする。

conda create -n senerio python==3.10

ここでPythonの指定を失念すると以下のエラーで conda install が止まってしまうので注意。

CondaSSLError: OpenSSL appears to be unavailable on this machine. OpenSSL is required to download and install packages.

仮想環境を有効化する

conda activate senerio

仮想環境にFlaskをインストール

conda install flask

適当なサンプルコードを書いて実行

app.py
# -*- coding: utf-8 -*-
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return 'It works!'

if __name__ == '__main__':
    app.run()
python app.py

Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

がコンソールに出てきたら起動成功。 http://127.0.0.1:5000/ へアクセスすると It works! が表示される。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?