LoginSignup
0
0

More than 5 years have passed since last update.

mac で pyenv を使おうとしたら悲しいことになった話。

Last updated at Posted at 2019-04-17

pip を使いたくなったんだけれども、Mac (Mojave) に標準で入っている python さんは pip ないのですよね。
環境どうしようかな。標準の python を汚したくないので homebrew から入れることにしました。

$ brew install pyenv
-- 略 --
$ pyenv --version
pyenv 1.2.11
$ pyenv versions
* system (set by /Users/ninjaninja/.pyenv/version)

インストールが終わったようなので、 https://github.com/pyenv/pyenv#homebrew-on-macos ここにあるとおり、Basic GitHub Checkout の#3以降の手順を盲目的に進める。何も考えていない。

$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
$ cat ~/.bash_profile
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

おっけいっぽ

$ exec "$SHELL"

$SHELLなんて定義はなかったんで、sourceする

$ source ~/.bash_profile

では python をインストールしよう(・`ω・´)

$ pyenv install 3.7.3
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.3.tar.xz...
-> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
Installing Python-3.7.3...
python-build: use readline from homebrew

BUILD FAILED (OS X 10.14.4 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/qn/21yqw2396zl26pmq6tq0sw9c0000gn/T/python-build.20190416181805.8376
Results logged to /var/folders/qn/21yqw2396zl26pmq6tq0sw9c0000gn/T/python-build.20190416181805.8376.log

Last 10 log lines:
Python/pytime.c:1092:9: warning: this function declaration is not a prototype [-Wstrict-prototypes]
Python/pytime.c:1092:26: warning: comparison between pointer and integer ('int' and 'void *')
    if (gmtime_r(&t, tm) == NULL) {
        ~~~~~~~~~~~~~~~~ ^  ~~~~
10 warnings and 8 errors generated.
make: *** [Python/pytime.o] Error 1
make: *** Waiting for unfinished jobs....
2 warnings generated.
2 warnings generated.
2 warnings generated.

何か失敗したようだ。ログをみるとー

Python/pytime.c:695:11: error: implicit declaration of function 'clock_gettime' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    err = clock_gettime(CLOCK_REALTIME, &ts);

他にもあるけれども、これっぽ。
C99ではこの呼出し方は許さぬ。と、いう感じかなあ。

そういうわけで世界のみんなに聞いてみたところ、Macのライブラリに clock_gettime なんてものはないとのことでした:(;゙゚'ω゚'):
そしてたくさんの人が困っておりました。
シンプルな回答はこれ。
https://stackoverflow.com/questions/47506176/error-while-trying-to-run-make-command-on-darknet-yolo-library-on-a-mac

別の方法を実装してコンパイル通せとのこと。他を探すとたくさん実装例がでてくるので書き換えちゃえばいいんだろうけれども、 homebrew 使って管理したいなって思っているので、考えるのをやめました。

なんの参考にもならない記事になってしまった。
venv でも使おう(´・ω・`)

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