3

这是我当前的项目设置:

.
├── 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

4

1 回答 1

0

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

于 2012-11-25T18:59:16.687 回答