2011-07-10 4 views
2

モジュールのインストールに問題があります。最初は、Mac OS Xで私のpythonのインストールを混乱させたと思っていましたが、私は仮想マシンとubuntu 11.04をインストールして同様の問題を抱えています。 os xとubuntuの両方が同じエラーで失敗するのはなぜですか?エラーに関するPythonモジュールのインストール時の問題

Installing collected packages: tkinter-pypy 
    Running setup.py install for tkinter-pypy 
    building '_tkinter' extension 
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWITH_APPINIT -I/usr/include/tcl -I/usr/include/tk -I/usr/include/python2.7 -c src/_tkinter.c -o build/temp.linux-i686-2.7/src/_tkinter.o 
    src/_tkinter.c:74:17: fatal error: tcl.h: No such file or directory 
    compilation terminated. 
    error: command 'gcc' failed with exit status 1 
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/pfm/build/tkinter-pypy/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-sMB5Wi-record/install-record.txt: 
    running install 

running build 

running build_ext 

building '_tkinter' extension 

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DWITH_APPINIT -I/usr/include/tcl -I/usr/include/tk -I/usr/include/python2.7 -c src/_tkinter.c -o build/temp.linux-i686-2.7/src/_tkinter.o 

src/_tkinter.c:74:17: fatal error: tcl.h: No such file or directory 

compilation terminated. 

error: command 'gcc' failed with exit status 1 

---------------------------------------- 
Command /usr/bin/python -c "import setuptools;__file__='/home/pfm/build/tkinter-pypy/setup.py';execfile(__file__)" install --single-version-externally-managed --record /tmp/pip-sMB5Wi-record/install-record.txt failed with error code 1 
Storing complete log in /home/pfm/.pip/pip.log 
+0

Tkinterはビルトインパッケージだと思っていました。あなたはすでにそれをインポートしようとしましたか? – fncomp

+0

私はそれも確かです。 – Blender

+0

私は答えとして私のコメントを入れている、私はカップルのインストールをチェックし、それは私のアクションなしで利用可能だった。 – fncomp

答えて

2

はわからないが、Tkinterには、あなたのPythonがインストールして利用できるようになります。

たとえば、私はそれが失敗するとTkinterのインストールすることはできません。 import Tkinterに行ってみましたか?関連するノートでは、setuptools(別名。easy_install)または他の同様のインストールツールを使用することをお勧めします。その後

EDIT

のTkinterはまだ利用できない場合、その後、Linux上で、locate lib-tkを試してみて、あなたのpythonのパスに追加

import sys; sys.path.append(PATH_TO_TK)

セットアップを得るためのWikiをチェックしてくださいスティックする:http://wiki.python.org/moin/TkInter

もう1つのEDIT

簡単な回避策は、Tkinter(OPに記載)に依存するIDLEをインストールすることです。

+0

ubuntuに同梱されているパッケージで私の運が役に立たない。 Python 2.7.1+(r271:86832、2011年4月11日、18:05:24) [GCC 4.5.2] on linux2 「ヘルプ」、「著作権」、「クレジット」または「ライセンス」と入力してください情報。 >>>インポートのTkinter トレースバック(最後の最新の呼び出し): ファイル ""、ライン1、 はImportError中: – PFlans

+1

@PFMケースはTkinterという名前のモジュールがインポートTkinter' – fncomp

+0

>>>インポートのTkinter '試す重要トレースバック(最新の最終コール): ファイル ""、行1、 ファイル "/usr/lib/python2.7/lib-tk/Tkinter"。Python-tkパッケージをインストールしてください。 ImportError:_tkinterという名前のモジュールがありません。python-tkパッケージをインストールしてください。 – PFlans

5

Ubuntu 11.04にtkinter-pypyをインストールしようとしたときとまったく同じ問題が発生しました。エラーメッセージは、/ usr/include/tclにあるtcl.hファイルを探していることを示していますが、そこにはありません。私はtclライブラリの開発版をインストールする必要があります(私はtcl8.4-devをインストールしました)。

sudo apt-get install tcl8.4-dev

これは/usr/include/tcl8.4にヘッダファイルをインストールします。次に、それを指し示す/ usr/include/tclのシンボリックリンクを作成しました。また、/ usr/include/tclディレクトリにtk.hヘッダ(tkinter-pypyでも必要)をインストールしたtkライブラリの開発版(tk8.4-devなど)もインストールしました。

これらの手順を実行すると、tkinter-pypyを正常にインストールできます。

+0

情報ありがとう、私はWindowsでそれを行う方法を見つけることができるかどうかを見てみましょうsetup.pyのライブラリの場所をtclソースの場所に編集する私は同じ闘いの結論としてダウンロードしましたが、あなたのtcl(8.4)はdaからほとんど外れていると思いますテ。私がtcl8.5でダウンロードしたソース。 –

関連する問題