开发模式下的python安装程序包失败

时间:2013-03-20 12:15:15

标签: python django packages

我正在尝试在开发模式下设置一个简单的包:

setup.py

from setuptools import setup, find_packages

setup(
    name='rocflavors',
    version='0.0.1',
    packages=find_packages(exclude=['ez_setup','examples','tests']),
    license='Creative Commons Attribution-Noncommercial-Share Alike license',
    long_description=open('README').read(),
    install_requires=[],
)

尝试设置:(如果我执行python setup.py安装,则有效)

(relux)roc-web5537:roc-flavors cmuench$ python setup.py install develop
running install
running bdist_egg
running egg_info
writing rocflavors.egg-info/PKG-INFO
writing top-level names to rocflavors.egg-info/top_level.txt
writing dependency_links to rocflavors.egg-info/dependency_links.txt
reading manifest file 'rocflavors.egg-info/SOURCES.txt'
writing manifest file 'rocflavors.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.7-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.7-intel/egg
creating build/bdist.macosx-10.7-intel/egg/rocflavors
copying build/lib/rocflavors/__init__.py -> build/bdist.macosx-10.7-intel/egg/rocflavors
copying build/lib/rocflavors/models.py -> build/bdist.macosx-10.7-intel/egg/rocflavors
creating build/bdist.macosx-10.7-intel/egg/rocflavors/templatetags
copying build/lib/rocflavors/templatetags/__init__.py -> build/bdist.macosx-10.7-intel/egg/rocflavors/templatetags
copying build/lib/rocflavors/templatetags/rocflavors_extras.py -> build/bdist.macosx-10.7-intel/egg/rocflavors/templatetags
copying build/lib/rocflavors/urls.py -> build/bdist.macosx-10.7-intel/egg/rocflavors
copying build/lib/rocflavors/views.py -> build/bdist.macosx-10.7-intel/egg/rocflavors
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/models.py to models.pyc
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/templatetags/__init__.py to __init__.pyc
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/templatetags/rocflavors_extras.py to rocflavors_extras.pyc
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/urls.py to urls.pyc
byte-compiling build/bdist.macosx-10.7-intel/egg/rocflavors/views.py to views.pyc
creating build/bdist.macosx-10.7-intel/egg/EGG-INFO
copying rocflavors.egg-info/PKG-INFO -> build/bdist.macosx-10.7-intel/egg/EGG-INFO
copying rocflavors.egg-info/SOURCES.txt -> build/bdist.macosx-10.7-intel/egg/EGG-INFO
copying rocflavors.egg-info/dependency_links.txt -> build/bdist.macosx-10.7-intel/egg/EGG-INFO
copying rocflavors.egg-info/top_level.txt -> build/bdist.macosx-10.7-intel/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/rocflavors-0.0.1-py2.7.egg' and adding 'build/bdist.macosx-10.7-intel/egg' to it
removing 'build/bdist.macosx-10.7-intel/egg' (and everything under it)
Processing rocflavors-0.0.1-py2.7.egg
Removing /Users/cmuench/.virtualenvs/relux/lib/python2.7/site-packages/rocflavors-0.0.1-py2.7.egg
Copying rocflavors-0.0.1-py2.7.egg to /Users/cmuench/.virtualenvs/relux/lib/python2.7/site-packages
rocflavors 0.0.1 is already the active version in easy-install.pth

Installed /Users/cmuench/.virtualenvs/relux/lib/python2.7/site-packages/rocflavors-0.0.1-py2.7.egg
Processing dependencies for rocflavors==0.0.1
Finished processing dependencies for rocflavors==0.0.1
running develop
Checking .pth file support in build/bdist.macosx-10.7-intel/egg
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 2] No such file or directory: 'build/bdist.macosx-10.7-intel/egg/test-easy-install-35540.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    build/bdist.macosx-10.7-intel/egg

This directory does not currently exist.  Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).

我有3个问题:

  1. 为什么它不适用于开发模式。
  2. 开发模式与不使用它有什么区别?
  3. 为什么需要成为一个包?如果我更改了包中的.py文件,它是如何将它返回到我的包目录中的。我不认为我理解包装的重点。当我进行更改时,它是否将编译的python代码放入包中?

1 个答案:

答案 0 :(得分:0)

确保您的virtualenv已激活。而不是python setup.py install develop,请尝试pip install -e .。注意.,这意味着您必须位于setup.py所在的目录中。如果失败,请尝试使用sudo

pip的文档:http://www.pip-installer.org/