Python setup.py指向。而不是setup.py中指定的目录?

时间:2012-11-23 23:08:37

标签: python setup.py

这是我目前的项目设置:

.
├── README.md
├── build
│   ├── bdist.macosx-10.8-intel
│   └── lib
├── dist
│   └── giordano-0.1-py2.7.egg
├── giordano.egg-info
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   ├── dependency_links.txt
│   ├── not-zip-safe
│   └── top_level.txt
├── requirements.txt
├── setup.py
├── src
│   ├── giordano
│   └── spider
├── test.txt
└── venv
    ├── bin
    ├── include
    ├── lib
    └── share

这是我的设置文件:

from setuptools import setup

setup(name='giordano',
  version='0.1',
  packages=['giordano'],
  package_dir={'giordano': 'src/giordano'},
  zip_safe=False)

当我执行python setup.py install时,我能够在代码中import giordano没有问题。

但是,当我在做python setup.py develop时,这是控制台输出:

[venv] fixSetup$ python setup.py develop
running develop
running egg_info
writing giordano.egg-info/PKG-INFO
writing top-level names to giordano.egg-info/top_level.txt
writing dependency_links to giordano.egg-info/dependency_links.txt
reading manifest file 'giordano.egg-info/SOURCES.txt'
writing manifest file 'giordano.egg-info/SOURCES.txt'
running build_ext
Creating /Users/blah/Dropbox/projects/Giordano/venv/lib/python2.7/site-packages/giordano.egg-link (link to .)
Removing giordano 0.1 from easy-install.pth file
Adding giordano 0.1 to easy-install.pth file

Installed /Users/blah/Dropbox/projects/Giordano
Processing dependencies for giordano==0.1
Finished processing dependencies for giordano==0.1

我注意到鸡蛋与.相关联而不是src/giordano。我的代码中不再import giordano

为什么开发的任何想法都不尊重package_dir

1 个答案:

答案 0 :(得分:0)

尝试'giordano':'src'。 distutils / distribute在您指定的目录中查找模块或包名称;在您粘贴的代码中,值是一个目录太深。