Python将DLL复制到Windows上的站点包 [英] Python copy a DLL to site-packages on Windows
本文介绍了Python将DLL复制到Windows上的站点包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
将您的DLL放在$ $ c的 package_data
$ c> setup()(请参阅安装包数据部分的distutils文档了解详情)。
如果您需要将DLL放在包目录外,可以使用 data_files
选项。例如,将它放在 site-packages
目录中:
import distutils.sysconfig
setup(
#[...]
data_files = [(distutils.sysconfig.get_python_lib(),[/ path / to / the / DLL ])],
)
I am writing a python extension module that needs to link with a third-party DLL. How can I copy this DLL to the site-packages directory using distutils (i.e. in my setup.py file)?
解决方案
Put your DLL in the package_data
argument of your setup()
(see the Installing Package Data section of the distutils documentation for details).
If you need to put the DLL outside of the package directory , you can use the data_files
option. For example to put it in the site-packages
directory:
import distutils.sysconfig
setup(
# [...]
data_files = [(distutils.sysconfig.get_python_lib(), ["/path/to/the/DLL"])],
)
这篇关于Python将DLL复制到Windows上的站点包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文