Я пытаюсь установить различные версии python3 на macOS Mojave 10.14.2 Beta (18C52a)
.
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.7.tar.xz...
-> https://www.python.org/ftp/python/3.6.7/Python-3.6.7.tar.xz
Installing Python-3.6.7...
python-build: use readline from homebrew
BUILD FAILED (OS X 10.14.2 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/db/pjnyydt54kl3_snfwpvlsxf40000gp/T/python-build.20181204115752.83999
Results logged to /var/folders/db/pjnyydt54kl3_snfwpvlsxf40000gp/T/python-build.20181204115752.83999.log
Last 10 log lines:
./Include/pytime.h:200:52: warning: declaration of 'struct tm' will not be visible outside of this function [-Wvisibility]
PyAPI_FUNC(int) _PyTime_localtime(time_t t, struct tm *tm);
^
./Include/pytime.h:204:49: warning: declaration of 'struct tm' will not be visible outside of this function [-Wvisibility]
PyAPI_FUNC(int) _PyTime_gmtime(time_t t, struct tm *tm);
^
2 warnings generated.
2 warnings generated.
2 warnings generated.
2 warnings generated.
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.5.6.tar.xz...
-> https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tar.xz
Installing Python-3.5.6...
python-build: use readline from homebrew
BUILD FAILED (OS X 10.14.2 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/db/pjnyydt54kl3_snfwpvlsxf40000gp/T/python-build.20181204115931.92145
Results logged to /var/folders/db/pjnyydt54kl3_snfwpvlsxf40000gp/T/python-build.20181204115931.92145.log
Last 10 log lines:
Python/pytime.c:508:13: warning: implicit declaration of function 'clock_getres' is invalid in C99 [-Wimplicit-function-declaration]
if (clock_getres(CLOCK_REALTIME, &res) == 0)
^
Python/pytime.c:508:13: warning: this function declaration is not a prototype [-Wstrict-prototypes]
Python/pytime.c:508:26: error: use of undeclared identifier 'CLOCK_REALTIME'
if (clock_getres(CLOCK_REALTIME, &res) == 0)
^
4 warnings and 2 errors generated.
make: *** [Python/pytime.o] Error 1
make: *** Waiting for unfinished jobs....
Я пробовал, brew
:
pyenv
, python
, python3
, xz
, readline
, openssl
(за этот ответ)sudo installer -pkg/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target/
(за документы pyenv)10.14.1 (18B75)
, и у меня такая же проблема. О, и черт, я использую Рыбу. Я должен посмотреть и посмотреть, является ли это проблемой, специфичной для рыб (Обновление: нет, это не рыба, это происходит в стандарте /bin/sh
)
Если вы хотите и поддерживать разные версии Python, asdf является хорошим вариантом. Вы можете использовать следующие шаги для установки.
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.6.2
И так как вы, кажется, используете рыбу, вы можете сделать следующее
echo 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish
mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
На этом этапе вы захотите перезапустить свой терминал, чтобы asdf вступил в силу. В одной Mac OS вам может понадобиться установить coreutils automake autoconf openssl libyaml readline libxslt libtool unixodbc
, так как некоторым плагинам они могут понадобиться.
Затем вы можете установить плагин Python. Сначала надо это потянуть.
asdf plugin-add python
После того, как вы установили плагин, пришло время установить необходимые версии.
asdf install python 3.5.6
asdf install python 3.6.7
Как только они успешно установлены, вы можете переключаться между ними, используя
asdf global python <version-of-your-choice: eg. 3.5.6>
например. asdf global python 3.5.6
Надеюсь, это поможет.