Error while trying to install python
I downloaded python-3.6.1.tar.xz. then i extracted this. There is a README.rst file. this is an instruction file. and has instructions on how to install.
On Unix, Linux, BSD, macOS, and Cygwin:
./configure
make
make test
sudo make install
Completed 1st two steps, i.e. make no mistakes. But when I make test
get these errors.
FAILED (failures=1)
test test_venv failed
1 test failed again:
test_venv
Total duration: 4 min 13 sec
Tests result: FAILURE
Makefile:1018: recipe for target 'test' failed
make: *** [test] Error 1
I created an error file and shared it on google drive. Click here for the complete stack trace.
Relevant part of the error:
**Subprocess Output**
Traceback (most recent call last):
File "/home/kd/Python-3.6.1/Lib/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/kd/Python-3.6.1/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/kd/Python-3.6.1/Lib/ensurepip/__main__.py", line 4, in <module>
ensurepip._main()
File "/home/kd/Python-3.6.1/Lib/ensurepip/__init__.py", line 189, in _main
default_pip=args.default_pip,
File "/home/kd/Python-3.6.1/Lib/ensurepip/__init__.py", line 102, in bootstrap
_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/home/kd/Python-3.6.1/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
source to share
zipimport.ZipImportError: unable to unzip data; zlib is not available
You have to install zlib1g-dev
and change your setup step as follows:
./configure --with-zlib=/usr/include
Now try this:
make clean
apt-get install zlib1g-dev
./configure --with-zlib=/usr/include
...
You can read more in Configure and Compile Python with Zlib
source to share
When I tried to install Python 3.7.3 via pyenv
I got the same error. This was solved by ensuring that I had the prerequisites for my operating system, with the following:
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev python-openssl git
I found this in pyenv General build problems , thanks to Agibalov .
source to share