Shipping part of Python standard library

前端 未结 2 636
孤城傲影
孤城傲影 2021-01-26 11:00

How do I ship some standard modules from Python together with my code?

I\'m writing an add-on for Anki, for which I need Queue and threading mo

2条回答
  •  故里飘歌
    2021-01-26 11:13

    For anybody else who is wondering how to import a .so file (I was using a library that tried to import parser and discovered that parser.__file__ was a .so file) the answer is it's the same as a .py file:

    Create a directory (mkdir parser), copy the .so file into that directory (cp parser.cpython-37m-x86_64-linux-gnu.so parser/) and then add an __init__.py to the directory (touch parser/__init__.py).

    This is almost certainly not cross platform, but it worked for my needs.

提交回复
热议问题