【笔记】解决Ubuntu 22.04下安装fasttext遇到的问题

1. 在Ubuntu 22.04下安装fasttext:

$ pip install fasttext

2. 遇到缺少gcc的问题:

RuntimeError: Unsupported compiler -- at least C++11 support is needed!

3. 于是安装gcc

$ sudo apt install gcc

4. 之后继续安装fasttext遇到缺少g++的问题

$ pip install fasttext

gcc: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory

5. 安装g++遇到libc6版本依赖的问题

$ sudo apt install g++

libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.9) but 2.35-0ubuntu3.1 is to be installed
             Depends: libc-dev-bin (= 2.31-0ubuntu9.9) but it is not going to be installed
             Depends: libcrypt-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

6. 经过查看版本,gcc版本为9.4,尝试安装版本11失败

$ sudo apt install gcc-11 g++-11

E: Unable to locate package gcc-11
E: Unable to locate package g++-11

7. 反复查找帮助解决未果,想起之前安装环境时,按照指导修改了/etc/apt/sources.list,将其回复原设置,再次安装编译环境,并重新安装fasttext成功

$ vi /etc/apt/sources.list

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install --reinstall build-essential
$ gcc --version
$ g++ --version
$ pip install fasttext

 

猜你喜欢

转载自blog.csdn.net/miles2007/article/details/130583710