(base) root@st-desktop:~/Chinese-LangChain# pip3 install cchardet
Collecting cchardet
Using cached cchardet-2.1.7.tar.gz (653 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: cchardet
Building wheel for cchardet (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/cchardet
copying src/cchardet/version.py -> build/lib.linux-x86_64-cpython-310/cchardet
copying src/cchardet/__init__.py -> build/lib.linux-x86_64-cpython-310/cchardet
running build_ext
building 'cchardet._cchardet' extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
creating build/temp.linux-x86_64-cpython-310/src/cchardet
creating build/temp.linux-x86_64-cpython-310/src/ext
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet/src
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet/src/LangModels
gcc -pthread -B /root/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /root/anaconda3/include -fPIC -O2 -isystem /root/anaconda3/include -fPIC -Isrc/ext/uchardet/src -I/root/anaconda3/include/python3.10 -c src/cchardet/_cchardet.cpp -o build/temp.linux-x86_64-cpython-310/src/cchardet/_cchardet.o
gcc: fatal error: cannot execute ‘cc1plus’: execvp: 没有那个文件或目录
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cchardet
Running setup.py clean for cchardet
Failed to build cchardet
Installing collected packages: cchardet
Running setup.py install for cchardet ... error
error: subprocess-exited-with-error
× Running setup.py install for cchardet did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
running install
/root/anaconda3/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/cchardet
copying src/cchardet/version.py -> build/lib.linux-x86_64-cpython-310/cchardet
copying src/cchardet/__init__.py -> build/lib.linux-x86_64-cpython-310/cchardet
running build_ext
building 'cchardet._cchardet' extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
creating build/temp.linux-x86_64-cpython-310/src/cchardet
creating build/temp.linux-x86_64-cpython-310/src/ext
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet/src
creating build/temp.linux-x86_64-cpython-310/src/ext/uchardet/src/LangModels
gcc -pthread -B /root/anaconda3/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /root/anaconda3/include -fPIC -O2 -isystem /root/anaconda3/include -fPIC -Isrc/ext/uchardet/src -I/root/anaconda3/include/python3.10 -c src/cchardet/_cchardet.cpp -o build/temp.linux-x86_64-cpython-310/src/cchardet/_cchardet.o
gcc: fatal error: cannot execute ‘cc1plus’: execvp: 没有那个文件或目录
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> cchardet
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
==================================================================================
解决办法很简单,
apt install g++
apt install python3-dev
装完后,重新pip安装cchardet就正常了
文章评论