指定絕對路徑
python在使用execjs執行js也可以指定node_modules路徑,這樣就不需要進行環境變量的添加了。
js_code = open("toutiao_signature.js", "r", encoding="utf-8").read()
ctx = execjs.compile(
# npm root -g 查看全局 node_modules 的路徑
js_code, cwd=r"/usr/local/lib/node_modules"
)
js_code = open("toutiao_signature.js", "r", encoding="utf-8").read()
ctx = execjs.compile(
# npm root -g 查看全局 node_modules 的路徑
js_code, cwd=r"/usr/local/lib/node_modules"
)
https://github.com/zhangbo2008/Trie_with_informationExtraction_and_fuzzy_matchingv2