1

開発モードで単純なパッケージをセットアップしようとしています:

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 install を実行すると動作します)

(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 コードがパッケージに入れられますか?
4

1 に答える 1

0

virtualenvがアクティブ化されていることを確認してください。の代わりにpython setup.py install develop、を試してくださいpip install -e .。に注意してください.。これは、setup.pyがあるディレクトリにいる必要があることを意味します。失敗した場合は、を試してくださいsudo

pipのドキュメント:http ://www.pip-installer.org/

于 2013-03-20T12:20:06.400 に答える