Flask

Flask


Flask容器:01 | 02

20240107
参考:https://blog.csdn.net/qq_15821487/article/details/123248571

1、建立基础镜像容器
docker run -itd --privileged -p 7777:7777 -v D:BYPProgrammingPythonFlask:/var/www/html --name PythonWeb centos:7 /usr/sbin/init

2、进入容器
docker exec -it PythonWeb bash

3、安装wget
yum install wget

4、Anaconda下载
wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh

5、Anaconda安装
bash Anaconda3-2021.11-Linux-x86_64.sh
(如果提示找不到bunzip2...yum install -y bzip2)

5、环境变量
vi /etc/profile
在最后输入:
PATH=$PATH:/root/anaconda3/bin
export PATH

6、激活环境
source /etc/profile

检查是否安装成功:
(1)输入:echo $PATH 可以看到:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/data/anaconda3/bin:/data/anaconda3/bin:/root/anaconda3/bin
(2)conda activate
(3)conda -V
conda 4.10.3

7、conda的channel地址
(1)配置清华大学的conda的channel地址
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes

(2)配置北京外国语大学的conda的channel地址
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config --set show_channel_urls yes

查看源地址:
conda config --show-sources
结果:
==> /root/.condarc <==
channels:
- https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- defaults
show_channel_urls: True

8、创建环境
conda create -y -n web python=3

查看conda环境:
conda info -e

报错处理:
conda activate web
出现以下错误:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

$ conda init

解决办法:重新进入虚拟环境在命令窗口输入:
source activate
即可进入base环境,然后就可以切换到新建立的web环境了
参考:https://blog.csdn.net/qq_35203425/article/details/103223892









python上手--flask框架web开发实践
python访问报错:jinja2.exceptions.TemplateNotFound: index.html解决
Docker 之 Python Flask 服务的构建运行
Python Web框架最好?Django vs Flask vs FastAPI
官网
【非常详细】Flask开发基础与入门

Last update: 2024-01-20|Pageview:23
Research Blog: EC | EC_INFO | EC_WORK |


BypResearch