3
0

More than 1 year has passed since last update.

M1Mac + Pyenv + Pyenv-Virtualenvでの'pyenv install'時エラー

Posted at

前提

  • Mac M1Max
  • Pyenv + Virtualenvを利用していて、ある日pyenv installができなくなった

エラー内容

pyenvで新しいPythonをインストールしようとすると、下記のようなエラーが出る。
アーキテクチャ絡み?M1のせい?

$ pyenv install 3.7.12

Last 10 log lines:
  "_libintl_textdomain", referenced from:
      _PyIntl_textdomain in libpython3.7m.a(_localemodule.o)
      _PyIntl_textdomain in libpython3.7m.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: clangerror: : linker command failed with exit code 1 (use -v to see invocation)error: 
linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1

対処法

いろいろなサイトに転がっていた、下記対処法が効きそう。
必要ないものもあるかも。誰か教えてください。

binutilsのアンインストール

そもそも私の環境では入っていなかった。

$ brew uninstall binutils
Error: No such keg: /opt/homebrew/Cellar/binutils

XcodeのCommand Line Toolsの設定

  1. xcodeを起動
  2. Preferenceをクリック
  3. Locationsタブを選択
  4. Command Line Toolsが選択されていない場合は、選択する

Pyenvの再インストール

上だけでは治らなかったので、再インストール。キャッシュの削除などは不要。

brew uninstall pyenv-virtualenv
brew uninstall pyenv
brew install pyenv
brew install pyenv-virtualenv

実行

$ pyenv install 3.7.12
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Installing Python-3.7.12...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.7.12 to /Users/<USER NAME>/.pyenv/versions/3.7.12

動いた!

3
0
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
3
0