2
votes

i had a problem with installing packages to new upgraded python to version 3.7

When i type:

python3.7 -m pip install pip -d

/usr/local/bin/python3.7: No module named pip

I make easy_install like this: sudo easy_install pip what solve previous problems, but now it create pip3.7 in a weird way. Whem i calling for pip3.8 version, this returns me a message:

pip3.7 -V

pip 19.2.3 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

Someone know what i am doing wrong? I tried many things to resolve it. Reinstall, purge, install with symbolic link from python2 etc.

There is a script which i used to install python3.7 (i had also a problem with zlib):

sudo cd /home
sudo wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
sudo tar xf Python-3.7.3.tar.xz
sudo cd ./Python-3.7.3/
sudo ./configure
sudo make
sudo make install
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3 10
python3 --version

Where is a mistake?

1
sudo apt-get install python3-pip (assuming Ubuntu). - CristiFati
why not just use the pip3 binary? - Jethro Cao
pip is not part of python. You need to install it separately using the command provided by @CristiFati . Also I would suggest not to install python using the procedure that followed above. It caused some issues for me before. Here's a better way to do it. linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04 Try the 1st method in that. - Underoos
@CristiFati seriously? I did it, previously I removed of course. - Guaz
I don't know how easy_install works, but it seems that it automatically finds Python 3.5, which is wrong. You need to let it know that you want it for 3.7. Also your env (${PYTHONPATH}) might cause some trouble. - CristiFati

1 Answers

4
votes

Answer finally i find myself. There: https://linuxize.com/post/how-to-install-python-3-7-on-debian-9/

There with similar errors you can recompile it, even without removal (on secound machine i checked without removal) failed installation before.

If someone want to good upgrade with everywith working on debian 9. I recommend that script:

NOW_DIR=$(pwd)
apt update
apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
mkdir ~/python_upgrade
cd ~/python_upgrade
curl -O https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
tar -xf Python-3.7.3.tar.xz
cd Python-3.7.3
./configure --enable-optimizations
make -j $(nproc)
make altinstall
python3.7 --version
cd $NOW_DIR
rm -rf ~/python_upgrade

There are minor changes from that commands in tutorial. Run above file.sh as root.

It can take some times, on my virtual machine with 2 cores during another job it takes 40 minutes. I hope someone find there good answer, not totally green comments like 'apt install' which is first try action before looking to web.