pyenv构建失败(使用python-build 20180424的Fedora 28)

时间:2018-08-29 04:43:56

标签: python python-3.x pyenv

我正在尝试安装python 3.7.0,这是构建失败后日志文件中消息的一部分:

......

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_dbm                  _gdbm                 _tkinter           
_uuid                 nis                                      
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc                  atexit                pwd                
time                                                           

running build_scripts
creating build/scripts-3.7
copying and adjusting /tmp/python-build.20180829114540.17502/Python-3.7.0/Tools/scripts/pydoc3 -> build/scripts-3.7
copying and adjusting /tmp/python-build.20180829114540.17502/Python-3.7.0/Tools/scripts/idle3 -> build/scripts-3.7
copying and adjusting /tmp/python-build.20180829114540.17502/Python-3.7.0/Tools/scripts/2to3 -> build/scripts-3.7
copying and adjusting /tmp/python-build.20180829114540.17502/Python-3.7.0/Tools/scripts/pyvenv -> build/scripts-3.7
changing mode of build/scripts-3.7/pydoc3 from 664 to 775
changing mode of build/scripts-3.7/idle3 from 664 to 775
changing mode of build/scripts-3.7/2to3 from 664 to 775
changing mode of build/scripts-3.7/pyvenv from 664 to 775
renaming build/scripts-3.7/pydoc3 to build/scripts-3.7/pydoc3.7
renaming build/scripts-3.7/idle3 to build/scripts-3.7/idle3.7
renaming build/scripts-3.7/2to3 to build/scripts-3.7/2to3-3.7
renaming build/scripts-3.7/pyvenv to build/scripts-3.7/pyvenv-3.7
Creating directory /home/gio/.pyenv/versions/3.7.0/bin
if test "no-framework" = "no-framework" ; then \
    /usr/bin/install -c python /home/gio/.pyenv/versions/3.7.0/bin/python3.7m; \
else \
    /usr/bin/install -c -s Mac/pythonw /home/gio/.pyenv/versions/3.7.0/bin/python3.7m; \
fi
if test "3.7" != "3.7m"; then \
    if test -f /home/gio/.pyenv/versions/3.7.0/bin/python3.7 -o -h /home/gio/.pyenv/versions/3.7.0/bin/python3.7; \
    then rm -f /home/gio/.pyenv/versions/3.7.0/bin/python3.7; \
    fi; \
    (cd /home/gio/.pyenv/versions/3.7.0/bin; ln python3.7m python3.7); \
fi
if test -f libpython3.7m.a && test "no-framework" = "no-framework" ; then \
    if test -n "" ; then \
        /usr/bin/install -c -m 555  /home/gio/.pyenv/versions/3.7.0/bin; \
    else \
        /usr/bin/install -c -m 555 libpython3.7m.a /home/gio/.pyenv/versions/3.7.0/lib/libpython3.7m.a; \
        if test libpython3.7m.a != libpython3.7m.a; then \
            (cd /home/gio/.pyenv/versions/3.7.0/lib; ln -sf libpython3.7m.a libpython3.7m.a) \
        fi \
    fi; \
    if test -n ""; then \
        /usr/bin/install -c -m 555  /home/gio/.pyenv/versions/3.7.0/lib/; \
    fi; \
else    true; \
fi
zsh:9: parse error near `fi'
make: *** [Makefile:1173: altbininstall] Error 1

BUILD FAILED行之后没有更多信息:

我通过pyenv安装了

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

并已安装所有给定要求。

sudo yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel \
openssl-devel xz xz-devel libffi-devel

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshenv
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshenv
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.zshenv

但是每次仍会收到上述错误消息。我该如何运作?

1 个答案:

答案 0 :(得分:0)

问题解决了。

以某种方式,我的/bin/sh被链接到/usr/bin/zsh。 将/bin/sh链接回/usr/bin/bash之后,Pyenv安装已修复。