【Python】pip install が出来ない件について!
解決済
回答 2
投稿
- 評価
- クリップ 2
- VIEW 53K+
スクレイピングテストのためにpyqueryを使おうと思いまして
pip install pyquery としたところ、下記エラーが出ました。
running build_ext
building 'lxml.etree' extension
creating build/temp.linux-x86_64-2.6
creating build/temp.linux-x86_64-2.6/src
creating build/temp.linux-x86_64-2.6/src/lxml
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/tmp/pip-build-QGh7cx/lxml/src/lxml/includes -I/usr/include/python2.6 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.6/src/lxml/lxml.etree.o -w
src/lxml/lxml.etree.c:8:22: error: pyconfig.h: No such file or directory
src/lxml/lxml.etree.c:16:20: error: Python.h: No such file or directory
src/lxml/lxml.etree.c:18:6: error: #error Python headers needed to compile C extensions, please install development version of Python.
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-QGh7cx/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PU1e5J-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-QGh7cx/lxml
pyqueryに関わらず、pip install で色々とインストールしようとするとすべてエラーが出てしまいます。
pip install はできなくなってしまったのでしょうか?
原因をご存知の方いらっしゃいましたら教えて頂けないでしょうか?
よろしくお願い致します。
OS:CentOS6.6
Python2.6(2.7)
ちなみにOSをクリーンインストールしてこのサイトを参考に何回かチャレンジしてみましたが、結果はかわりませんでした。
参考サイト
http://momijiame.tumblr.com/post/72664567612/centos-6-5-python-setuptools-pip
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
checkベストアンサー
+1
Cエクステンションビルドに必要なpython.hやpyconfig.hがないと怒っていらっしゃるようですね。
これだけの情報ではよくわからないので、断定的なことはいえないですが、
試しに
sudo yum -y install gcc gcc-c++ kernel-devel
sudo yum -y install python-devel
とやってみてから、もう一回pip installをやってみてもらえますか?
以上、参考まで。
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
0
ありがとうございます。
導入することができました!
(yum install libxslt-develを入れたらSuccessとなりました)
Successfully installed lxml-3.4.1 pyquery-1.2.9
pip install が出来ずにこんなに困るとは思ってもいませんでした。
大変感謝しております!
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.23%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
2014/12/28 18:25
先ほどと違うエラー結果となりました。
10000文字制限があってここにはすべて載せられませんが、下記のようなエラーでした。
src/lxml/lxml.etree.c:200579: error: ‘XML_XPATH_INVALID_CHAR_ERROR’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200621: error: ‘XML_XPATH_UNDEF_VARIABLE_ERROR’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200631: error: ‘XML_XPATH_UNDEF_PREFIX_ERROR’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200641: error: ‘XML_XPATH_UNKNOWN_FUNC_ERROR’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200651: error: ‘XML_XPATH_INVALID_OPERAND’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200661: error: ‘XML_XPATH_INVALID_TYPE’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200671: error: ‘XML_XPATH_INVALID_ARITY’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200681: error: ‘XML_XPATH_INVALID_CTXT_SIZE’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200691: error: ‘XML_XPATH_INVALID_CTXT_POSITION’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200921: error: ‘LIBXSLT_VERSION’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200933: error: ‘xsltLibxsltVersion’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200945: error: ‘__pyx_v_4lxml_5etree_XSLT_DOC_DEFAULT_LOADER’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200945: error: ‘xsltDocDefaultLoader’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200954: error: ‘xsltDocLoaderFunc’ undeclared (first use in this function)
src/lxml/lxml.etree.c:200954: error: expected ‘)’ before ‘__pyx_f_4lxml_5etree__xslt_doc_loader’
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-0fW6t0/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-Zdi7gR-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0fW6t0/lxml
2014/12/28 18:28
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
(2014年12月現在)
とするのがよいです。
このあたりはブランチがsetuptoolsとdistributeで割れてから統合されたりいろいろ変化が激しいのでベストプラクティスは日々変化していってる感じでなんだかなあという感じですけど。苦笑
2014/12/28 18:41
あーlxmlのビルドに必要なパッケージが入っていませんね。。。
では次はこれを。
yum install libxslt-devel
他にもひょっとするとlibxslt1, libxslt, libxml2-develも必要かもしれない、とStack Overflowの人が言ってますね。
健闘を祈ります。
(参考)
http://stackoverflow.com/questions/4642942/setup-py-install-lxml-with-python2-6-on-centos