python-inotify 在linux上安裝,pythoninotify
python-inotify 在linux上安裝0 下載
$ wget --no-check-certificate https://pypi.python.org/packages/source/p/pathlib/pathlib-1.0.1.tar.gz$ wget --no-check-certificate https://bitbucket.org/JanKanis/python-inotify/get/2193c8bdeb3b.zip
1 Ubuntu14.04
python2.7.6
gcc4.8.2
1.1 pathlib
$ cd pathlib-1.0.1$ sudo python setup.py install
1.2 python-inotify
$ cd JanKanis-python-inotify-2193c8bdeb3b$ sudo python setup.py install
1.3 測試
$ cd JanKanis-python-inotify-2193c8bdeb3b/examples$ python simple.py
2 RHEL6.4
python2.7.9
gcc-4.4.7
2.1 pathlib
# cd pathlib-1.0.1# python setup.py install
2.2 python-inotify
# cd JanKanis-python-inotify-2193c8bdeb3b# python setup.py install
出現IN_EXCL_UNLINK錯誤, 在JanKanis-python-inotify-2193c8bdeb3b/inotify/_inotify.c的開頭添加下面的代碼:
/* _inotify.c */.../* Exclude events on unlinked objects. */#ifndef IN_EXCL_UNLINK# define IN_EXCL_UNLINK 0x04000000#endif
3 RHEL5.4
python2.5
gcc-4.1.x
3.1 首先升級python1) 從源碼安裝依賴zlib-devel:
## get zlib-devel source and build install it$ wget --no-check-certificate http://zlib.net/zlib-1.2.8.tar.gz$ tar -zxf zlib-1.2.8.tar.gz$ cd zlib-1.2.8$ ./configure$ make && make install#### /usr/local/include/zlib.h zconf.h
2) 從源碼安裝依賴python-devel:
$ wget --no-check-certificate https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz$ tar -zxf Python-2.7.9.tgz$ cd Python-2.7.9$ ./configure -–with-zlib=/usr/local/include --enable-unicode=ucs4$ make && make install## test:$ python>>> import zlib
--enable-unicode=ucs4太重要了, 如果不指定這個, 安裝python-inotify後運行測試程式simple.py時會出現錯誤:
ERROR: undefined symbol: PyUnicodeUCS4_FromFormat
3.2 安裝python-inotify
參考2.1, 2,2.