PyEnv BUILD FAILED installing Python on MacOS

后端 未结 8 2011
无人及你
无人及你 2020-12-23 11:57

While trying to install Python 3.6.6 (for Airflow) using PyEnv on MacOS, I am encountering build failure

相关标签:
8条回答
  • 2020-12-23 12:29

    short answer:

    $ brew upgrade
    

    now you can try to install python through pyenv

    $ pyenv install 3.7.4
    

    then, you have to set the python path

    pyenv global 3.7.4
    

    now, close and open a new terminal and write the command

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

    That's all. For me it was fine.

    0 讨论(0)
  • 2020-12-23 12:31

    I was able to get away with above error by referring to Common build problems

    • brew install readline xz
    • xcode-select --install
    • brew install openssl

    After this, I installed and initialized pyenv

    • brew install pyenv
    • pyenv init (inside your project directory)

    Finally install and activate required python version

    • pyenv install 3.6.6
    • pyenv local 3.6.6 (inside your project directory)

    Here's the link to original thread #1188 on GitHub by @Harry Moreno

    0 讨论(0)
  • 2020-12-23 12:34

    The only way I could get it working is through the below prefixes before installing

    CFLAGS="-I$(brew --prefix readline)/include -I$(brew --prefix openssl)/include 
    -I$(xcrun --show-sdk-path)/usr/include" \
    LDFLAGS="-L$(brew --prefix readline)/lib -L$(brew --prefix openssl)/lib" \
    PYTHON_CONFIGURE_OPTS=--enable-unicode=ucs2 \
    pyenv install -v 3.7.1
    
    0 讨论(0)
  • 2020-12-23 12:35
    BUILD FAILED (OS X 10.14.3 using python-build 20180424)
    
    Inspect or clean up the working tree at /var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745
    Results logged to /var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745.log
    
    Last 10 log lines:
      File "/private/var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745/Python-3.6.6/Lib/ensurepip/__main__.py", line 5, in <module>
        sys.exit(ensurepip._main())
      File "/private/var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745/Python-3.6.6/Lib/ensurepip/__init__.py", line 204, in _main
        default_pip=args.default_pip,
      File "/private/var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745/Python-3.6.6/Lib/ensurepip/__init__.py", line 117, in _bootstrap
        return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
      File "/private/var/folders/kt/79hj2dxs5vg7gsy188n6tk9c0000gn/T/python-build.20190226112205.71745/Python-3.6.6/Lib/ensurepip/__init__.py", line 27, in _run_pip
        import pip._internal
    

    I found the solution from http://digidememory.blogspot.com/2019/01/macos-mojave-10142python371.html

    In my case, I solved by this command

    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    
    0 讨论(0)
  • 2020-12-23 12:39

    The accepted answer didn't work for me (Mojave) but this did:

    sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
    

    Credit to http://www.blog.howechen.com/macos-mojave-pyenv-install-multi-version-build-failed-solution/

    0 讨论(0)
  • 2020-12-23 12:40

    I had this problem with Mojave and Python 3.7.3.

    This worked for me:

    SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk MACOSX_DEPLOYMENT_TARGET=10.14 pyenv install 3.7.3
    
    0 讨论(0)
提交回复
热议问题