讓你的linux支援chm文檔的閱讀

來源:互聯網
上載者:User

標籤:chm   linux下如何開啟chm   gnochm   python.h:no such file   

對於程式員來說經常要查看一些Reference協助文檔,可是面對一些舊文檔,以及在沒有網路的狀況下,如何讓你的linux支援chm文檔的閱讀,那麼看下文吧!

方法一:

簡單方法,在你的FirefoxFirefox上安裝擴充(Add-on),搜尋有一個chmreader,選擇安裝,重啟firefox瀏覽器即可。

       要看*.chm只需在終端執行:

firefox *.chm &

優點:安裝簡單,看純英文文檔毫無壓力;

缺點:相容性較差,部分很多中文不支援,如我的c語言函數參考手冊.chm只能部分顯示中文;

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/48/02/wKiom1QFVLLB2CyXAACgXPUkeRk020.jpg" title="image002.jpg" alt="wKiom1QFVLLB2CyXAACgXPUkeRk020.jpg" />

只能部分顯示中文

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/02/wKiom1QFVQmSbP6KAABfwbXnuAI315.jpg" title="image004.jpg" alt="wKiom1QFVQmSbP6KAABfwbXnuAI315.jpg" />



 

方法二:安裝gnochm

首先,我的安裝環境:

[[email protected]]# lsb_release -a

LSBVersion:  :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch

DistributorID:       RedHatEnterpriseServer

Description:    Red Hat Enterprise Linux Server release 6.2(Santiago)

Release:   6.2

Codename:     Santiago

Linuxversion 2.6.32-220.el6.x86_64 ([email protected]) (gccversion 4.4.5 20110214 (Red Hat 4.4.5-6) (GCC) ) #1 SMP Wed Nov 9 08:03:13 EST2011

 

安裝gnochm

1. 下載gnochm的原碼包

wget http://ncu.dl.sourceforge.net/project/gnochm/gnochm/0.9.11/gnochm-0.9.11.tar.gz

tar zcvf gnochm-0.9.11.tar.gz

cd gnochm-0.9.11

先閱讀README

可以的知,有兩種方法安裝,

 

我們採用源碼安裝

需要以下幾個

此版本依賴軟體包

 

REQUIREMENTS

 

  - PyCHM (or python-chm)  (>= 0.8.4)

  - Python                 (>= 2.2.1)

                           Also, python musthave gettext and locale modules

  - pygtk2                 (>= 1.99.12)

  - pygtk2-libglade        (>= 1.99.12)

  - gnome-python2          (>= 1.99.11)

  - gnome-python2-gtkhtml2 (>= 1.99.11)

  - gnome-python2-gconf    (>= 1.99.11)

  - gnome-python2-bonobo   (>= 1.99.11)

 

2.下載pychm

pychm-0.8.4.tar.gz

http://nchc.dl.sourceforge.net/project/gnochm/pychm/0.8.4/pychm-0.8.4.tar.gz

 

其他軟體包用 yum search 一下即可找到。

安裝:

yum install Python pygtk2pygtk2-libglade gnome-python2 gnome-python2-gtkhtml2 gnome-python2-gconf gnome-python2-bonobo   -y

 

安裝pychm-0.8.4.tar.gz

(該軟體是拿python和linux_c編寫的,作為一個較為小的開源軟體,還是比較值得一看的)

tar zxvf pychm-0.8.4.tar.gz

cd pychm-0.8.4

python setup.py install

此時會提示 chm/swig_chm.c:681:21: error: chm_lib.h: No such file or directory等多行錯誤;

閱讀README

看到要安裝chmlib,並提供

http://66.93.236.84/~jedwin/projects/chmlib(可惜連結已經失效)

Google以下給出地址是rpm包

http://pkgs.repoforge.org/chmlib/

可以看到以下兩個包

chmlib-0.40-1.el6.rf.x86_64.rpm   11-Nov-2010 07:30   49K  RHEL6 and CentOS-6 x86 64bit

chmlib-devel-0.40-1.el6.rf.x86_64.rpm    11-Nov-2010 07:30   12K  RHEL6 and CentOS-6 x86 64bit

安裝chmlib

再次執行

python setup.py install

依舊還有問題:

chm/swig_chm.c:13:20: error: Python.h:No such file or directory

於是想了下~~發現所給的依賴包列表肯定差一些,於是查看Python找到問題

沒裝Python-devel

於是安裝python-devel-2.6.6-29.el6.x86_64.rpm

再次執行python setup.py install

可以看到成功資訊:creating /usr/lib64/python2.6/site-packages/chm

 

再次到gnochm-0.9.11

./configure

make

su -

Makeinstall

 

最後,執行gnochm 就可以安裝成功了

gnochm../../c語言函數參考手冊.chm

(可以看到與FirefoxFirefox上安裝擴充(Add-on)的chmreader對中文的支援更好!)

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/48/04/wKioL1QFVSax6nK9AADQfc1c6OM627.jpg" title="image006.jpg" alt="wKioL1QFVSax6nK9AADQfc1c6OM627.jpg" />

PS:可能還會出現一些字型的問題,其他的README說的很明白

Chinesecharacters are not displayed properly!

 

Thereare two issues are involved in this problem, but first, make sure

you rungnochm with the "-d" flag and have a look in ~/.gnochm/gnochm.log

to seethat at least one of the "encoding" or "lcid" in your fileare

correct.Some dodgy chms do not have proper encodings in them.

 

If theencoding is correct, then:

1) Thecontents pane does not show the proper characters

   - Try installing the cjkpython support forChinese located in

     http://cjkpython.i18n.org.

2) TheHTML window shows some rubbish!

 

具體問題,看日誌!


本文出自 “M層” 部落格,請務必保留此出處http://mengix.blog.51cto.com/7194660/1547830

讓你的linux支援chm文檔的閱讀

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.