building Python from source with zlib support

后端 未结 10 756
广开言路
广开言路 2020-11-28 04:18

When building Python 3.2.3 from source on Ubuntu 12.04, the zlib module is not available.

I downloaded the official source distribution from python.org, and attempte

10条回答
  •  迷失自我
    2020-11-28 04:53

    The only solution that helped me with installing python 3.5.1 was to apt-get zlib1g-dev (and other packages such as python-setuptools and python-pip) and then rebuild python 3.5.1 from source.

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
    sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
    sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
    sudo apt-get install libssl-dev openssl
    cd ~
    mkdir build
    cd build
    wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
    tar -zxvf Python-3.5.1.tgz
    cd Python-3.5.1
    ./configure
    make
    sudo make install
    

    Taken from: https://github.com/MrYsLab/xideco/wiki/Installing-Python-3.5

    As I undestand new build of python is made with inclusion of previously apt-getted related packages. So when you browse the content of new Python-3.5.1/lib/site-packages there will be pip and setuptools. More importantly, they will be copied to any virtualenv you make using Python-3.5.1 AND this virtualenv will use THEM insted of system-default. This is very, very important to rememmber when installing new python version. Otherwise one might get into a black hole of errors such as:

    • zlib not installed;
    • "pip install ..." executed from virtualenv that installs package to system-default python instead of virtualenv.

提交回复
热议问题