https://github.com/vrasneur/pyfasttext/issues/51
系统环境:
- MacOS Mojave 10.14.6
- Python 3.6.8
按照 pyfasttext 给的方式安装,均出现类似的报错:
法1. pip 安装
前置依赖
pip install cythonpip install cysignals
安装
pip install pyfasttext
报错,与 gcc 相关

法2. 源码安装
cd project/venv/lib/python3.6/site-packagesgit clone --recursive https://github.com/vrasneur/pyfasttext.gitcd pyfasttextpip install -r requirements.txtpython setup.py install
报错,依然和编译器有关
解决方案
pyfasttext issues 给的解决方案,大部分是在安装时,声明 gcc 或者 g++ 的路径。
注意: mac 自带的 gcc 或 g++,位于 /usr/bin/gcc 和 /usr/bin/g++

使用 brew install / update gcc,安装至/usr/local/bin 下:

但即使指定 CXX=/usr/local/bin/gcc-9 CC=/usr/local/bin/gcc-9 路径后,再进行安装,依然报错。
最后发现,mac 使用 clang 编译,重新更改编译路径,就可以成功安装了(两种方式都可以)。
Solution: CXX=/usr/bin/clang CC=/usr/bin/clang pip3 install --no-cache pyfasttext
本文详细记录了在MacOS Mojave环境下,使用pip及源码方式安装pyfasttext遇到的编译错误,并提供了通过指定Clang编译器路径成功解决问题的方法。


5043

被折叠的 条评论
为什么被折叠?



