问题:
在Mac上安装fasttext的时候,发现g++或者clang都不能直接引用。于是在终端用which检查了一下,发现都是存在于/usr/bin/目录中的。
$ which g++
/usr/bin/g++
a$ which clang
/usr/bin/clang
引用时会出错。例如:我查一下他们的版本:
$ g++ --version
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
DianadeMacBook:~ diana$ clang --version
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
解决办法:
进入mac的终端,输入xcode-select --install回车,根据提示安装 xcode-select
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
最后提示软件已安装:
点击完成。重新进入终端,再试一试,上面的g++/clang都可以用了:
$ g++ --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
这个mac版本已经默认支持clang。没有特别需要,就不再折腾单独的g++了。
此时,用g++和clang都可以安装fasttext。这里以g++为例:
$ CC=g++ pip3 install fasttext
Collecting fasttext
Using cached fasttext-0.9.2.tar.gz
……
Successfully installed fasttext-0.9.2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)