Re: [問題] import moudle on mac
※ 引述《MAGICXX (逢甲阿法)》之銘言:
: 我自己compile出一個libTRANING.pyd的檔案要給我的python程式碼使用
: import imp
: imp.find_module('TRANING',[r'/Applications/QGIS.app/plugins/my_lib/'])
: 因為在mac下面lib的名稱是lib"name".附檔名(dylib,pyd等)
Read the doc.
http://docs.python.org/2/library/imp.html
imp.find_module(name[, path])
[...]
Otherwise, path must be a list of directory names; each directory is
searched for files with any of the suffixes returned by get_suffixes()
above. Invalid names in the list are silently ignored (but all list items
must be strings).
打開 interpreter
>>> import imp
>>> imp.get_suffixes()
[('.so', 'rb', 3), ('module.so', 'rb', 3), ('.py', 'U', 1), ('.pyc', 'rb', 2)]
>>>
沒有 .pyd
所以當然找不到
請編成 .so 或使用 .pyc (not a good idea IMO)
--
Les grandes et les meilleurs tone from "Zadok the Priest"
Eine grosse stattliche Veranstaltung by F. Handel
THE MAIN EVENT! These are the men
Sie sind die Besten
"Champions League" by Tony Britten THESE ARE THE CHAMPIONS!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.32.81.146
推
08/07 23:24, , 1F
08/07 23:24, 1F
→
08/07 23:25, , 2F
08/07 23:25, 2F
→
08/07 23:25, , 3F
08/07 23:25, 3F
推
08/07 23:29, , 4F
08/07 23:29, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章