- Download the most recent release version from liblouis repo.(zip file)
- Check your environment.
import louisis not supportable atarm64architecture(v 3.21.0). Onlyx86_64would be able to get the correct path. - Unzip your installed file.
- RUN
./configure - RUN
make - RUN
sudo make install - Move to python folder and RUN
python setup.py install - You would be able to
import louisand test.
EXAMPLE:
import louis
print(louis.translateString(["braille-patterns.cti", "en-us-g2.ctb"], "Hello, World!"))
#⠠⠓⠑⠇⠇⠕⠂⠀⠠⠸⠺⠖
print(louis.backTranslateString(["braille-patterns.cti", "en-us-g2.ctb"], "⠓⠑⠇⠇⠕"))
#helloIf you have this problem(issue #990)(cython OSError), follow these steps:
(I got this error when I tried deploying web server, nginx & gunicorn on Ubuntu)
- Go to
~/python/louis/__init__.py - Add function
CDLLinsidefrom ctypes import ~ - Fix line 61:
- RUN
python setup.py installagain - Go to
/usr/local/lib(your library file) and check ifliblouis.so.20andliblouis.aexist - Copy those files to your python
louispackage folder. For example, my conda environments are:/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/. So I usedcpcommands to copy. - Now it should work! :)
import os
path_f = os.path.abspath( os.path.join(os.path.dirname(__file__), "liblouis.so.20"))
liblouis = CDLL(path_f)cp -a liblouis* /home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/