質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

14424閲覧

cryptographyのインストール時のエラー(python)

tug

総合スコア7

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2016/07/18 05:21

###やりたいこと
pythonでssh接続をしたく、paramikoを利用したいのですが、import時にエラーが発生してしまいます。
このエラーをなくしたいです。

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python/lib/python3.4/site-packages/paramiko/__init__.py", line 30, in <module> from paramiko.transport import SecurityOptions, Transport File "/usr/local/python/lib/python3.4/site-packages/paramiko/transport.py", line 32, in <module> from cryptography.hazmat.backends import default_backend ImportError: No module named 'cryptography'

###エラー内容
cryptographyをインストールすればよいのかと思い、

pip install cryptography ```を実行すると以下のエラーが発生し、インストールできません。 ```ここに言語を入力 Downloading/unpacking cryptography Downloading cryptography-1.4.tar.gz (399kB): 399kB downloaded Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography no previously-included directories found matching 'docs/_build' warning: no previously-included files matching '*' found under directory 'vectors' Downloading/unpacking idna>=2.0 (from cryptography) Downloading idna-2.1-py2.py3-none-any.whl (54kB): 54kB downloaded Requirement already satisfied (use --upgrade to upgrade): pyasn1>=0.1.8 in /usr/local/python/lib/python3.4/site-packages (from cryptography) Downloading/unpacking six>=1.4.1 (from cryptography) Downloading six-1.10.0-py2.py3-none-any.whl Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/python/lib/python3.4/site-packages (from cryptography) Downloading/unpacking cffi>=1.4.1 (from cryptography) Downloading cffi-1.7.0.tar.gz (400kB): 400kB downloaded Running setup.py (path:/tmp/pip_build_root/cffi/setup.py) egg_info for package cffi ~長くて投稿できないので中略します~ File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 246, in run_setup DirectorySandbox(setup_dir).run(runner) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 276, in run return func() File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 245, in runner _execfile(setup_script, ns) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 47, in _execfile exec(code, globals, locals) File "/tmp/easy_install-m3_qrp91/cffi-1.7.0/setup.py", line 192, in <module> return True File "/usr/local/python/lib/python3.4/distutils/core.py", line 163, in setup raise SystemExit("error: " + str(msg)) SystemExit: error: command 'gcc' failed with exit status 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1100, in run_setup run_setup(setup_script, args) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 249, in run_setup raise File "/usr/local/python/lib/python3.4/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 197, in setup_context yield File "/usr/local/python/lib/python3.4/contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 168, in save_modules saved_exc.resume() File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 143, in resume six.reraise(type, exc, self._tb) File "/usr/local/python/lib/python3.4/site-packages/pkg_resources/_vendor/six.py", line 685, in reraise raise value.with_traceback(tb) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 156, in save_modules yield saved File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 197, in setup_context yield File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 246, in run_setup DirectorySandbox(setup_dir).run(runner) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 276, in run return func() File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 245, in runner _execfile(setup_script, ns) File "/usr/local/python/lib/python3.4/site-packages/setuptools/sandbox.py", line 47, in _execfile exec(code, globals, locals) File "/tmp/easy_install-m3_qrp91/cffi-1.7.0/setup.py", line 192, in <module> return True File "/usr/local/python/lib/python3.4/distutils/core.py", line 163, in setup raise SystemExit("error: " + str(msg)) SystemExit: error: command 'gcc' failed with exit status 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip_build_root/cryptography/setup.py", line 333, in <module> **keywords_with_side_effects(sys.argv) File "/usr/local/python/lib/python3.4/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/usr/local/python/lib/python3.4/site-packages/setuptools/dist.py", line 279, in __init__ self.fetch_build_eggs(attrs['setup_requires']) File "/usr/local/python/lib/python3.4/site-packages/setuptools/dist.py", line 323, in fetch_build_eggs replace_conflicting=True, File "/usr/local/python/lib/python3.4/site-packages/pkg_resources/__init__.py", line 826, in resolve dist = best[req.key] = env.best_match(req, ws, installer) File "/usr/local/python/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1092, in best_match return self.obtain(req, installer) File "/usr/local/python/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1104, in obtain return installer(requirement) File "/usr/local/python/lib/python3.4/site-packages/setuptools/dist.py", line 390, in fetch_build_egg return cmd.easy_install(req) File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 664, in easy_install return self.install_item(spec, dist.location, tmpdir, deps) File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 694, in install_item dists = self.install_eggs(spec, download, tmpdir) File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 875, in install_eggs return self.build_and_install(setup_script, setup_base) File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1114, in build_and_install self.run_setup(setup_script, setup_base, args) File "/usr/local/python/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 1102, in run_setup raise DistutilsError("Setup script exited with %s" % (v.args[0],)) distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1 Cleaning up... Command /usr/local/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-dogbba2h-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography Storing debug log for failure in /root/.pip/pip.log

###試したこと

エラーが多くて何が問題かが分からないので、
"--compile failed with error code 1"の辺りに着目してweb検索して調べました。

https://teratail.com/questions/4839 を参考にして、
yum install gcc gcc-c++ kernel-devel
yum install python-devel
yum install libxslt-devel
をインストールしていますが、上記のエラーの状態です。

###補足情報
OS:CentOS
python3.4.1

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

pipでのインストールは、モジュールによってはこのようにビルドでハマってしまいますので、
Anacondaを導入された方が良いかも知れません。
cryptographyはAnacondaに入っています。

paramikoは入っていないので、それは改めて別途インストールしてください。

詳しくは、下記の質問を参考にしてください。

Python 3.x - virtualenvにモジュールがインストールできません。(41398)|teratail
https://teratail.com/questions/41398

投稿2016/07/18 05:39

argius

総合スコア9388

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問