指导思想:从【安装镜像】转变为【进入容器内部直接安装包】
大佬说:“就用你现有的镜像作为基础,在里面安装uwsgi就好了。你可以把它当作你的django开发环境。”
指导过程见链接https://blog.csdn.net/m0_46629123/article/details/122922538
重要指令:
docker ps
C:\Windows\system32>docker ps
(查看docker正在运行的容器)
docker exec -it < container > /bin/bash
C:\Windows\system32>docker exec -it pp_container4_slim /bin/bash
(进入容器内部)
pip
C:\Windows\system32>docker exec -it pp_container4_slim /bin/bash
(进入容器内部)
root@973528a8ae49:/code/package# pip
(查看容器内部的pip命令)
pip install uwsgi(可能会报错)
- 安装指令pip install uwsgi
root@973528a8ae49:/code/package# pip install uwsgi
(pip安装uwsgi)
- 出错信息
AttributeError: 'NoneType' object has no attribute 'split'
(windows系统/linux插件不全时下会报错)
Exception: you need a C compiler to build uWSGI
(建uWSGI需要C compiler)
- 大佬说需要安装GCC(yum install gcc)
yum install gcc(过程有可能会出错)
- 安装指令yum install gcc
root@973528a8ae49:/code/package# yum install gcc
(安装gcc)
bash: yum: command not found
(未安装yum)
- 获取linux版本
root@973528a8ae49:/code/package# cat /proc/version
(获取linux版本)
Linux version 5.10.16.3-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Fri Apr 2 22:23:49 UTC 2021
- uname -a命令用于显示系统信息
root@973528a8ae49:/code/package# uname -a
(Linux uname(英文全拼:unix name)命令用于显示系统信息。)
Linux 973528a8ae49 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 GNU/Linux
- apt-get update更新软件列表
https://blog.csdn.net/qq_40563761/article/details/84107480
root@973528a8ae49:/code/package# apt-get update
(更新软件列表https://blog.csdn.net/qq_40563761/article/details/84107480)
Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:2 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [118 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
Fetched 8503 kB in 7s (1212 kB/s)
Reading package lists... Done
- apt-get install gcc 来安装gcc
root@973528a8ae49:/code/package# apt-get install gcc
(gcc安装)
......
此处略过一万字
......
pip install uwsgi未报错的界面
root@973528a8ae49:/code/package# pip install uwsgi
(安装uwsgi)
Collecting uwsgi
Using cached uwsgi-2.0.20.tar.gz (804 kB)
Building wheels for collected packages: uwsgi
Building wheel for uwsgi (setup.py) ... done
Created wheel for uwsgi: filename=uWSGI-2.0.20-cp38-cp38-linux_x86_64.whl size=510248 sha256=9be4add8f0457318596920a5b66f7c5f00b0996a47a9f871a7cfa97b6fc2581b
Stored in directory: /root/.cache/pip/wheels/cb/4d/54/002a215100a8c4e125654600f0a4304dae742442ddc4ba6ea1
Successfully built uwsgi
Installing collected packages: uwsgi
Successfully installed uwsgi-2.0.20