简体   繁体   中英

Ruby: graphical-user interface tk on linux ubuntu don't work

I tried installing the tk GUI for Ubuntu ruby With the command:

gem install tk

But the command does not work. What can I do?

Hey I ran into this same thing recently while porting the Princeton Standard library to ruby tk standard_draw_tk

First make sure libaries are installed

sudo apt-get install tcl8.5-dev tk8.5-dev

Now you need to soft link the libaries

sudo ln -s /usr/lib/x86_64-linux-gnu/tcl8.5/tclConfig.sh /usr/lib/tclConfig.sh
sudo ln -s /usr/lib/x86_64-linux-gnu/tk8.5/tkConfig.sh /usr/lib/tkConfig.sh
sudo ln -s /usr/lib/x86_64-linux-gnu/libtcl8.5.so.0 /usr/lib/libtcl8.5.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libtk8.5.so.0 /usr/lib/libtk8.5.so.0```

Now you can install the tk gem on linux

gem install tk

The original blog post where I found this information

在安装TK之前,您需要Ruby dev(包含所有HEADERS):

sudo apt-get install ruby-all-dev

You can use options too.

gem install tk -- --with-tcltkversion=8.6 \
--with-tcl-lib=/usr/lib/x86_64-linux-gnu \
--with-tk-lib=/usr/lib/x86_64-linux-gnu \
--with-tcl-include=/usr/include/tcl8.6 \
--with-tk-include=/usr/include/tcl8.6 \
--enable-pthread

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM