Help us understand the problem. What is going on with this article?

【PyEnv】Python3.5.xを入れられない対策

More than 3 years have passed since last update.

はじめに

ちょっと新しい環境を手に入れたのでPython3.5.1を入れようと思ってドブにハマって解決できたのでシェア

環境

  • Mac OS X 10.10.5
  • PyEnv

問題

$ pyenv install 3.5.1
Downloading readline-6.3.tar.gz...
-> https://yyuu.github.io/pythons/56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43
Installing readline-6.3...
Installed readline-6.3 to /Users/nnsnodnb/.pyenv/versions/3.5.1

Downloading Python-3.5.1.tgz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
Installing Python-3.5.1...

BUILD FAILED (OS X 10.10.5 using python-build 20151222-8-g5c5205e)

Inspect or clean up the working tree at /var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169
Results logged to /var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169.log

Last 10 log lines:
  File "/private/var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169/Python-3.5.1/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/private/var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169/Python-3.5.1/Lib/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169/Python-3.5.1/Lib/ensurepip/__init__.py", line 116, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/ym/w77_0x8n6kx0bbnbz1s4sp_00000gs/T/python-build.20160125040015.59169/Python-3.5.1/Lib/ensurepip/__init__.py", line 40, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

みたいな感じでエラーがでる

解決方法

zipimport.ZipImportError: can't decompress data; zlib not available
このエラーメッセージでググったらIssue出てきた

Python 3.5 Issue #454 | GitHub

@nikolay I had the same issue, and was able to fix by updating command line tools on OSX. Just run xcode-select --install

Once, that's finished, you should be able to install 3.5.0

こんな感じなことが書いてあった。Xcode command line toolsを入れろということらしい

$ xcode-select --install

入れて差し上げる

確認

$ pyenv install 3.5.x  # xはお好みで

インストールが終わったらpyenv rehash && pyenv global 3.5.xとかやる。
それでpyenv versionspython -Vとかで確認して無事インストールができていることを確認

最後に

GitHubのIssueを見る限りどうやらPython3.5.x系のときに出ているらしいですね。
command line tools自体は入れておいて損はないと思うから別にいんですけどねw

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした