1

When I tried to build Python 3 on Ubuntu 18.04.2 LTS, it shows me the next error.

When type:

./configure
make
make test

3 tests failed again:

test_urllib test_urllib2 test_urllib2net
Makefile:958: recipe for target 'test' failed
make: *** [test] Error 1

Someone help me

jww
  • 97,681
  • 90
  • 411
  • 885
willywoonka
  • 13
  • 1
  • 6
  • I've always had success following the instructions here: https://docs.python-guide.org/starting/install3/linux/ – SuperShoot Mar 25 '19 at 04:50
  • You're trying to **compile** it, you're not in the installation yet. You should consider changing your title, installing it from the Ubuntu repositories or assessing if the built-in Python within Ubuntu is enough for you. – Paradox Mar 25 '19 at 04:58
  • 1
    Please show the missing output from `make test`. Possible duplicate of [How would I build python myself from source code on Ubuntu?](https://stackoverflow.com/q/8097161/608639). Also see [How to build Python 3.4.6 from source?](https://stackoverflow.com/q/43622171/608639) – jww Mar 25 '19 at 05:32

2 Answers2

2

First, make sure your system is fully updated:

sudo apt update
sudo apt upgrade

Next, install the default GCC toolchain with:

sudo apt install build-essential

Next, we need to install a few prerequisites for building Python:

sudo apt install libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev

sudo apt install libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev

At the time of this writing, the latest stable version of Python is 3.7.1, if you want to use a newer version change the next instructions accordingly:

wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
tar xf Python-3.7.1.tar.xz
cd Python-3.7.1
./configure --enable-optimizations
make -j 8
sudo make altinstall
0

It seems like the ssl lib's not installed in your system. Try to fix it. Actually, you can give us much more information, if you run make test in a verbose mode: it will show you, what lines cause the problem

Kolay.Ne
  • 1,345
  • 1
  • 8
  • 23