ubuntu 18 上编译python3.7/ 3.8

in #note-timknip4 years ago

自己编译最新的稳定版,坑多

File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

编译python前需要安装libffi

apt install libffi-dev

通常的make && make install 会运行2-3小时的测试,非常慢,可以这样跳过测试:

make -j8 build_all
make -j8 altinstall