LoginSignup
6
3

More than 5 years have passed since last update.

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

Last updated at Posted at 2016-01-24

はじめに

ちょっと新しい環境を手に入れたので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

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3