1

setuptoolを使用してPythonパッケージを作成しましたが、問題が発生します。Ubuntuリポジトリからすべてをプレインストールすると機能しますが、PyPiを使用している場合、PyPiにはソースのみが含まれているため、インストールは失敗します。コンパイルされているため、インストール中に多くのエラーソースがあります。パッケージのインストール中にUbuntuパッケージをインストールするにはどうすればよいですか?私の考えはサブプロセスですが、もっと良い方法はありますか?

編集済み

エラーメッセージ

Reading http://pypi.python.org/simple/enable/
Reading http://code.enthought.com/projects/enable
Best match: enable 4.2.0
Downloading http://www.enthought.com/repo/ets/enable-4.2.0.tar.gz
Processing enable-4.2.0.tar.gz
Writing /tmp/easy_install-wuMg8s/enable-4.2.0/setup.cfg
Running enable-4.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-wuMg8s/enable-4.2.0/egg-dist-tmp-LbjqHY
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path /usr/local/include/python2.7 is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path  is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
Warning: distutils distribution has been initialized, it may be too late to add a library freetype2_srcWarning: distutils distribution has been initialized, it may be too late to add a library agg24_srcWarning: distutils distribution has been initialized, it may be too late to add a library kiva_srcWarning: distutils distribution has been initialized, it may be too late to add an extension _agg/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path /usr/X11R6/lib is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path /usr/X11/lib is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path /usr/X11R6/include is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:548: UserWarning: Specified path /usr/X11/include is invalid.
  warnings.warn('Specified path %s is invalid.' % d)
error: X11 libraries not found.

セットアップスクリプト:

from setuptools import setup

setup( 
    name = 'SomeName',
    version = '0.1',
    packages = ['src'],
    author = 'Some Author',
    maintainer = 'Some',
    maintainer_email = 'some@email.com',
    description = '',
    url = 'www.some.com',
    install_requires = ['envisage >= 4.0',
                        'pyface >= 4.0',
                        'apptools >= 4.0',
                        'chaco >= 4.0',
                        'traits >= 4.0',
                        'traitsui >= 4.0',
                        'mysql-connector-python >= 1.0',
                        'pysnmp >= 4.2',
                        'pyasn1 >= 0.1.4',
                        'M2Crypto >= 0.21.1',
                        'netifaces >= 0.7'

                        ],
 )
4

2 に答える 2

1

aptリポジトリからのインストールでは、ダウンロードされたバイナリは、必要なシステムライブラリですでに構築されています。そうでない場合、apt managerは、システムライブラリもインストールされていることを確認します。setuptools(pipまたはeasy_install)を使用してインストールすると、Pythonの要件のみが取得されます。ビルド/システム要件ではありません。

あなたの場合、エラーはerror: X11 libraries not found. 次のとおりです。これは、X11のビルドヘッダーがシステムで使用できないことを意味します。これを回避する簡単な方法は、パッケージ自体ではなく、パッケージの依存関係のみをダウンロードしてインストールするようにaptに指示することです。これにより、pipまたはeasy_installを使用するときに、Pythonが必要なものをすべて検出できるようになります。

たとえば、psycopg2Postgresql用のPythonライブラリです。ビルドするには、postgresqlサポートライブラリ(ヘッダーとファイル)が必要です。これらはPyPiからは入手できません。debianパッケージpython-psycopg2は、すべての外部要件を適切にインストールします。ここで、仮想環境にpsycopg2をインストールする場合は、最初に、システムにパッケージをビルドするためのすべての外部要件があることを確認する必要があるため、次のコマンドを実行します。

sudo apt-get build-dep python-pyscopg2

これにより、依存関係(すべてのサポートヘッダー)のみがインストールされるため、後で手動でインストールできます。

あなたの場合、を実行する必要がapt-get build-dep python-enableあり、それは必要なすべてをフェッチします:

# apt-get build-dep python-enable
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  cdbs libblas3gf libdrm-intel1 libdrm-radeon1 libdrm2 libfreetype6-dev
  libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa
  libglu1-mesa-dev liblapack3gf libpaper-utils libpaper1 libpthread-stubs0
  libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev libxdamage1
  libxdmcp-dev libxfixes3 libxslt1.1 libxxf86vm1 mesa-common-dev
  python-chardet python-docutils python-lxml python-numpy python-pygments
  python-pyrex python-roman python-setupdocs python-sphinx swig x11-common
  x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev
0 upgraded, 40 newly installed, 0 to remove and 0 not upgraded.
Need to get 35.5 MB of archives.
After this operation, 97.3 MB of additional disk space will be used.

これらのライブラリがすべてインストールされると、pypiパッケージが正しくインストールされます。

PyPiは、Pythonパッケージ(およびそれらのパッケージのPython固有の依存関係)専用です。外部要件の場合。インストールプロセスを成功させるには、インストールドキュメントでそれらを指定するか、システムで使用できるようにする必要があります。

于 2012-12-11T09:27:11.067 に答える
0

この変更されたスクリプトを使用してみてください。

from setuptools import setup

setup( 
    name = 'SomeName',
    version = '0.1',
    packages=find_packages(),
    author = 'Some Author',
    maintainer = 'Some',
    maintainer_email = 'some@email.com',
    description = '',
    url = 'www.some.com',
    install_requires = ['envisage',
                        'pyface',
                        'apptools',
                        'chaco',
                        'traits',
                        'traitsui',
                        'mysql-connector-python',
                        'pysnmp4',
                        'pyasn1',
                        'm2crypto',
                        'netifaces'

                        ],
 )
于 2012-12-11T09:23:12.330 に答える