1. GCC & G++ 问题,报错如下:
fatal error: math.h: No such file or directory
fatal error: limits.h: No such file or directory
- 解决方法:
- 修改
/etc/sources.list
内容为 ustc 软件镜像源 - 然后
sudo apt get update
更新索引之后重装GCC -
sudo apt-get remove gcc
卸载 GCC -
sudo apt-get install build-essential
重装 - 查看 gcc & g++ 是否安装成功
xxxxxxxxxxx# gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- 修改
2. 报错如下
pycocotools/_mask.c:14254:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
*type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14255:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
*value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14256:19: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
*tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c: In function ‘__Pyx__ExceptionReset’:
pycocotools/_mask.c:14263:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14264:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14265:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c:14266:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14267:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14268:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = tb;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c: In function ‘__Pyx__GetException’:
pycocotools/_mask.c:14323:24: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tmp_type = tstate->exc_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14324:25: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tmp_value = tstate->exc_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14325:22: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tmp_tb = tstate->exc_traceback;
^~~~~~~~~~~~~
curexc_traceback
pycocotools/_mask.c:14326:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?
tstate->exc_type = local_type;
^~~~~~~~
curexc_type
pycocotools/_mask.c:14327:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_value’; did you mean ‘curexc_value’?
tstate->exc_value = local_value;
^~~~~~~~~
curexc_value
pycocotools/_mask.c:14328:13: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
tstate->exc_traceback = local_tb;
^~~~~~~~~~~~~
curexc_traceback
error: command 'gcc' failed with exit status 1
- 解决办法(来源:走的那么干脆的博客):删除pycocotools文件夹(对应第二张图)下的pycache文件夹、_init.py文件、_mask.c文件以及_mask.cpython-36m-x86_64-linux-gnu.so文件。
3. 依赖的安装
checkdep_freetype2.c:3:6: error: #error "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
或者
Searching for scikit-learn
Reading https://pypi.python.org/simple/scikit-learn/
Downloading https://files.pythonhosted.org/packages/72/e4/75247cf75e9e3ba1bf296c9d26ba1cfc71d781821d32bcdb4d9b4b1b4153/scikit-learn-0.23.0.tar.gz#sha256=639a53df6273acc6a7510fb0c658b94e0c70bb13dafff9d14932c981ff9baff4
Best match: scikit-learn 0.23.0
Processing scikit-learn-0.23.0.tar.gz
Writing /tmp/easy_install-_oy3y34m/scikit-learn-0.23.0/setup.cfg
Running scikit-learn-0.23.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_oy3y34m/scikit-learn-0.23.0/egg-dist-tmp-frtmbvbp
Partial import of sklearn during the build process.
Traceback (most recent call last):
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/setuptools/sandbox.py", line 158, in save_modules
yield saved
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/setuptools/sandbox.py", line 199, in setup_context
yield
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/setuptools/sandbox.py", line 254, in run_setup
_execfile(setup_script, ns)
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/setuptools/sandbox.py", line 49, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-_oy3y34m/scikit-learn-0.23.0/setup.py", line 124, in <module>
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/home/fanglin/.conda/envs/action/lib/python3.6/site-packages/numpy/core/overrides.py", line 47, in <module>
""")
RuntimeError: implement_array_function method already has a docstring
或者
Searching for python-dateutil>=2.1
Reading https://pypi.python.org/simple/python-dateutil/
Downloading https://files.pythonhosted.org/packages/be/ed/5bbc91f03fa4c839c4c7360375da77f9659af5f7086b7a7bdda65771c8e0/python-dateutil-2.8.1.tar.gz#sha256=73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c
Best match: python-dateutil 2.8.1
Processing python-dateutil-2.8.1.tar.gz
Writing /tmp/easy_install-vap9bp6t/python-dateutil-2.8.1/setup.cfg
Running python-dateutil-2.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vap9bp6t/python-dateutil-2.8.1/egg-dist-tmp-g_wojrcb
/usr/share/anaconda3/envs/action/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'use_scm_version'
warnings.warn(msg)
warning: no previously-included files matching '__pycache__' found anywhere in distribution
warning: no previously-included files matching '*.py[co]' found anywhere in distribution
Moving python_dateutil-0.0.0-py3.6.egg to /usr/share/anaconda3/envs/action/lib/python3.6/site-packages
Adding python-dateutil 0.0.0 to easy-install.pth file
Installed /usr/share/anaconda3/envs/action/lib/python3.6/site-packages/python_dateutil-0.0.0-py3.6.egg
error: The 'python-dateutil>=2.1' distribution was not found and is required by matplotlib
- 解决方法:类似报错,都也可以通过手动安装依赖包
pip install package#
来解决,package#
达标报错中出现的依赖包名称。