部署运行环境如此艰难
- 运行镜像
- docker run -it --name my_sever3 -v /home/ubuntu/my_sever3:/root/my_sever3 python:3.8.5 bash
- No module named ‘torch’
- pip install torch -i https://pypi.mirrors.ustc.edu.cn/simple/ 更换临时源
- No module named ‘cv2
- pip install opencv-python
- pip install opencv-python-headless
- 错误:RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device(‘cpu’) to map your storages to the CPU.
- 在torch.load(xxx)中的xxx后添加map_location=torch.device('cpu')或者map_location='cpu'
- No module named 'rest_framework’
- pip install djangorestframework