pip install cpython
pip install pycocotools
2.如果你像我一样,在docker容器中安装,将会出现以下错误
root@57d0c7f5f9fb:/home/ts/cascade# pip install pycocotools
Collecting pycocotools
Downloading pycocotools-2.0.2.tar.gz (23 kB)
Requirement already satisfied: setuptools>=18.0 in /root/anaconda3/lib/python3.6/site-packages (from pycocotools) (39.1.0)
Requirement already satisfied: cython>=0.27.3 in /root/anaconda3/lib/python3.6/site-packages (from pycocotools) (0.28.2)
Requirement already satisfied: matplotlib>=2.1.0 in /root/anaconda3/lib/python3.6/site-packages (from pycocotools) (2.2.2)
Requirement already satisfied: numpy>=1.7.1 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (1.14.3)
Requirement already satisfied: cycler>=0.10 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (2.2.0)
Requirement already satisfied: python-dateutil>=2.1 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (2.7.3)
Requirement already satisfied: pytz in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (2018.4)
Requirement already satisfied: six>=1.10 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (1.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /root/anaconda3/lib/python3.6/site-packages (from matplotlib>=2.1.0->pycocotools) (1.0.1)
Building wheels for collected packages: pycocotools
Building wheel for pycocotools (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /root/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-k7a4ikcx
cwd: /tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/
Complete output (19 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-3.6/pycocotools
running build_ext
cythoning pycocotools/_mask.pyx to pycocotools/_mask.c
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/common
creating build/temp.linux-x86_64-3.6/pycocotools
gcc -pthread -B /root/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/anaconda3/lib/python3.6/site-packages/numpy/core/include -I./common -I/root/anaconda3/include/python3.6m -c ./common/maskApi.c -o build/temp.linux-x86_64-3.6/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
ERROR: Command errored out with exit status 1:
command: /root/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-cu0e7rob/install-record.txt --single-version-externally-managed --compile --install-headers /root/anaconda3/include/python3.6m/pycocotools
cwd: /tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/coco.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/cocoeval.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/__init__.py -> build/lib.linux-x86_64-3.6/pycocotools
copying pycocotools/mask.py -> build/lib.linux-x86_64-3.6/pycocotools
running build_ext
skipping 'pycocotools/_mask.c' Cython extension (up-to-date)
building 'pycocotools._mask' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/common
creating build/temp.linux-x86_64-3.6/pycocotools
gcc -pthread -B /root/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/root/anaconda3/lib/python3.6/site-packages/numpy/core/include -I./common -I/root/anaconda3/include/python3.6m -c ./common/maskApi.c -o build/temp.linux-x86_64-3.6/./common/maskApi.o -Wno-cpp -Wno-unused-function -std=c99
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /root/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_lj7zzx6/pycocotools_3af28aa3418749d0a7861430e3135dbf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-cu0e7rob/install-record.txt --single-version-externally-managed --compile --install-headers /root/anaconda3/include/python3.6m/pycocotools Check the logs for full command output.
docker容器中没有gcc,g++环境
参我我的博客gcc安装教程中的1,3
就可以了