Répertoire des notes
configuration yolov5 (cpu)
#打开anaconda命令窗
conda create -n yolov5 python=3.8
activate yolov5
git clone https://github.com/ultralytics/yolov5.git
#cd 进入到yolov5目录中
pip install -U -r requirements.txt
test yolov5
Téléchargez le code et le modèle yolov5 (fichier .pt) sur le site officiel https://github.com/ultralytics/yolov5
Ouvrez le dossier yolov5 et entrez
python detect.py --source 0 --weight E:\chengxu\yolov5\weights\yolov5s.pt
bogues et solutions
Description du problème
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'E:\anaconda\anaconda\envs\yolov5\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"'; __file__='"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\WYD\AppData\Local\Temp\pip-wheel-zb3vvgqh'
cwd: C:\Users\WYD\AppData\Local\Temp\pip-install-j7554uaz\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.8\pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
c:\users\wyd\appdata\local\temp\pip-install-j7554uaz\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\.eggs\cython-0.29.22-py3.8-win-amd64.egg\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\WYD\AppData\Local\Temp\pip-install-j7554uaz\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\pycocotools\_mask.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
building 'pycocotools._mask' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: urllib3, pyasn1, idna, chardet, six, rsa, requests, pyasn1-modules, oauthlib, cachetools, typing-extensions, requests-oauthlib, pytz, python-dateutil, pyparsing, Pillow, numpy, kiwisolver, google-auth, cycler, werkzeug, torch, tensorboard-plugin-wit, scipy, protobuf, pandas, matplotlib, markdown, grpcio, google-auth-oauthlib, Cython, absl-py, tqdm, torchvision, thop, tensorboard, seaborn, PyYAML, pycocotools, opencv-python
Running setup.py install for pycocotools ... error
ERROR: Command errored out with exit status 1:
command: 'E:\anaconda\anaconda\envs\yolov5\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"'; __file__='"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\WYD\AppData\Local\Temp\pip-record-hnl0f5un\install-record.txt' --single-version-externally-managed --compile --install-headers 'E:\anaconda\anaconda\envs\yolov5\Include\pycocotools'
cwd: C:\Users\WYD\AppData\Local\Temp\pip-install-j7554uaz\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\
Complete output (14 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.8
creating build\lib.win-amd64-3.8\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.8\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.8\pycocotools
running build_ext
skipping 'pycocotools\_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'E:\anaconda\anaconda\envs\yolov5\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"'; __file__='"'"'C:\\Users\\WYD\\AppData\\Local\\Temp\\pip-install-j7554uaz\\pycocotools_95037ce57904498d8c947bc8cb6b7ab2\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\WYD\AppData\Local\Temp\pip-record-hnl0f5un\install-record.txt' --single-version-externally-managed --compile --install-headers 'E:\anaconda\anaconda\envs\yolov5\Include\pycocotools' Check the logs for full command output.
Solution
Ouvrir l'URL: https: //github.com/philferriere/cocoapi
Cliquez entendre pour télécharger visual c ++ 2015
, puis téléchargez (si vite) à partir du comité ci-dessus: https :? //Gitee.com/jiangjiajun/philferriere-cocoapi _from = gitee_search
last Entrez dans le dossier PythonAPI et entrez: python setup.py build_ext --inplace
(yolov5) E:\chengxu\philferriere-cocoapi\PythonAPI>python setup.py build_ext --inplace
temps d'étude
2021.3.11