【问题标题】:__init__ module not getting copied when installing with setup.py使用 setup.py 安装时 __init__ 模块没有被复制
【发布时间】:2015-12-09 14:35:28
【问题描述】:

我有以下项目结构设置

/docs
    releaseNotes.rst
MANIFEST.in
/pySan
    __init__.py
    __init__.pyc
    /torrent
        __init__.py 
        components.py
    utils.py
    utils.pyc
setup.py
VERSION

但是当我在torrent 文件夹中安装__init__.py 时,没有被复制。

它安装在/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pySansetup.py 是:

from distutils.core import setup
from os import path

v = open(path.join(path.dirname(__file__), 'VERSION'))
VERSION = v.readline().strip()
v.close()

setup(
    name='pySan',
    version=VERSION,
    author='Ciasto Piekarz',
    author_email='Ciasto_piekarz@gmail.com',
    packages=['pySan', 'pySan/torrent'],
    data_files = ['VERSION'],
    license='LICENSE',
    description='Package is a collection of commonly used code for all my tools',
)

【问题讨论】:

    标签: python installation setuptools distutils setup.py


    【解决方案1】:

    问题出在这一行:

    packages=['pySan', 'pySan/torrent'],
    

    你需要使用包语法:

    packages=['pySan', 'pySan.torrent'],
    

    【讨论】:

    • 这个答案对我有帮助,但我正在使用 find_package:from setuptools import setup, find_packages ... packages=find_packages(include=['mypackage','mypackage.data']) 点对我有很大影响。
    【解决方案2】:

    除了以正确的格式提供 packages 值外,请确保您还运行“setup.py build”而不是“setup.py build_ext”,后者只会构建扩展而不复制任何 .py 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 2012-06-30
      相关资源
      最近更新 更多