hongyaohongyao/smart_classroom_demo

配置环境

xiangwentao666 opened this issue · 2 comments

配置环境的注意点来啦!

  1. 安装VisualStudio,注意在Installer中勾选“单个组件”中的“用于Windows的C++ CMake工具”然后再安装
  2. 安装Anaconda
  3. 在Anaconda中创建虚拟Python环境,版本是3.7
  4. 安装cmake:pip install cmake
  5. 安装boost:pip install boost
  6. 安装项目工程根目录下的requirements.txt:pip install -r requirements.txt
  7. 上pytorch官网找pytorch的安装指令,比如:pip3 install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio===0.11.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
  8. 运行smart_classroom_app.py即可啦!

【报错1】
安装numpy时报错:
Cannot uninstall numpy 1.21.2, RECORD file not found
【解决方法】
手动删除python的numpy模块的整个文件夹

【报错2】
pip安装时整个命令窗的所有文字变黄色并且抛出了警告
Why do I get this when using pip WARNING: Ignoring invalid distribution -ip?
【解决方法】
删除site-packages下的以“~”开头的所有文件夹

【报错3】
Tcl_AsyncDelete: async handler deleted by the wrong thread
【解决方法】
暂无,和垃圾回收机制有关
https://pysimplegui.readthedocs.io/en/latest/#multiple-threads

【报错4】
Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
【解决方法】
在代码开头添加如下代码:
import os os.environ["KMP_DUPLICATE_LIB_OK"] = "TRUE"

【报错5】
cv2开启摄像头或者读取本地视频文件时异常
Capture Video from Camera using cv2.VideoCapture(0) not working
【解决方法】
暂无,看英文文档会有帮助
https://stackoverflow.com/questions/12279833/videocapture-opencv-2-4-2-error-in-windows
https://stackoverflow.com/questions/42210880/python-cv2-videocapture-does-not-work-cap-isopened-returns-false?noredirect=1
https://answers.opencv.org/question/214735/cv2videocapture0isopened-return-always-false/
https://blog.csdn.net/qq_27278957/article/details/90701073
https://blog.csdn.net/Harpoon_fly/article/details/87007545
https://www.cnblogs.com/chenzhen0530/p/10746734.html
https://blog.csdn.net/Zhou_yongzhe/article/details/80310537
【报错6】
module 'cv2.cv2' has no attribute 'face'
【解决方法】
执行如下指令卸载、安装即可
pip uninstall opencv-contrib-python pip uninstall opencv-python pip install opencv-python pip install opencv-contrib-python
https://blog.csdn.net/hopena/article/details/91350271

此处更新对【报错3】的解决方案,刚解决了这个问题:
【报错3】
Tcl_AsyncDelete: async handler deleted by the wrong thread
【解决方法】
在代码的import位置添加如下语句:
import matplotlib
matplotlib.use('agg')
注意,请确保这两行语句在引起报错的那行代码之前执行!!