如何制作“python setup.py install"安装源文件而不是egg 文件? [英] how to make "python setup.py install" install source instead of egg file?
问题描述
我曾经在 python 项目中运行 python setup.py install
,它只会将源代码移动到 site-packages
,但有时它会 mv 一个 egg
文件到 site-packages
?
I used to run python setup.py install
in a python project, it will just move the source to site-packages
, but sometimes it will mv an egg
file to site-packages
?
#!/usr/bin/env python
# encoding: utf-8
from setuptools import setup,find_packages
setup(
name = "ipin_rpc_gen_vector",
version = "0.0.2",
packages = find_packages("src"),
package_dir={"":"src"},
install_requires=[
],
)
那么这背后有什么区别呢?什么时候安装源码,什么时候只安装egg
文件?如何强制安装源而不是 egg
文件?
So what is the difference behind this? When will it install source, when will it just install egg
file? How can I force install source instead of egg
file?
推荐答案
如果你想避免 zip (egg),你必须将 zip_safe
标志设置为 False
行为.
You have to set the zip_safe
flag to False
if you want to avoid the zip (egg) behaviour.
您可以在 https://setuptools.readthedocs.io/en/latest/userguide/miscellaneous.html#setting-the-zip-safe-flag.
另请查看https://setuptools.readthedocs.io/en/latest/userguide/keywords.html#new-and-changed-setup-keywords 和 *_package_data
标志(也位于:https://setuptools.readthedocs.io/en/latest/references/keywords.html).
Also check out https://setuptools.readthedocs.io/en/latest/userguide/keywords.html#new-and-changed-setup-keywords and the *_package_data
flags (also at: https://setuptools.readthedocs.io/en/latest/references/keywords.html).
这篇关于如何制作“python setup.py install"安装源文件而不是egg 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!