Skip to content

Instantly share code, notes, and snippets.

@naoko
Last active October 23, 2021 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save naoko/158ac9136c8b1d4f33d89fc32545b8d2 to your computer and use it in GitHub Desktop.
Save naoko/158ac9136c8b1d4f33d89fc32545b8d2 to your computer and use it in GitHub Desktop.
How to install OpenFst with Python Biding on OSX
# download
curl -O http://www.openfst.org/twiki/pub/FST/FstDownload/openfst-1.6.2.tar.gz
tar -xvzf openfst-1.6.2.tar.gz
rm openfst-1.6.2.tar.gz
cd openfst-1.6.2
./configure --enable-python
make
make install
# Test installtion
fstcompile --help
# Test python binding
python
>>> import pywrapfst
# Got on error?
# openfst installed site-package under `/usr/local/lib/python2.7/site-packages`
# check if the site-package is and should not match above...
python -m site --user-site
# one way to quickly fix is to add the site-package to your python path
export PYTHONPATH=$PYTHONPATH:"/usr/local/lib/python2.7/site-packages"
# then run `import pywrapfst` should be successful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment