1

I recently Installed python3.6 on debian 9.4 by these commands

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar xvf Python-3.6.5.tgz
cd Python-3.6.5
./configure --enable-optimizations --with-ensurepip=install
make -j8
sudo make altinstall
python3.6

it worked when i type python3.6

but pip doesn't installed on python3.6 so i decided to install it manually by these commands

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3.6 get-pip.py

i get this error

Traceback (most recent call last):
  File "get-pip.py", line 20649, in <module>
    main()
  File "get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available

and then i installed zlib by typing

sudo apt-get install zlib1g

still it doesn't work What should i do to install pip on python3.6.5 on debian9.4 stable please help

2 Answers2

0

I actually installed it again by

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 tk-dev

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

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

Once the above is finished, you could invoke the new Python interpreter with:

python3.6

Now everything is working!

  • In your question, you mentioned about `pip` not being installed, but in your answer you did not mention anything about `pip`. Could you please mention how did you solve the `pip` issue? – HelloWorld101 Nov 07 '18 at 16:48
0

I faced with same problem. Try to type:

pip3.6