6

I need to use Python3.7 for a project, but Ubuntu 20.04 doesn't have python3.7-dev in the apt repositories. I've installed Python3.7 from a tarball, but it doesn't install the headers. I noticed in the build directory that libpython3.7m.a exists, but I'm looking for libpython3.7.so. I don't see any options to build shared versus static library, and I don't where that file goes, I was hoping the build script would take care of that.

Does anyone know the recommended way to install python headers from older versions?

noel
  • 2,257
  • 3
  • 24
  • 39

3 Answers3

5
sudo apt-get install python3.7-dev

You can install it for any version of python. by sudo apt-get install python3.x-dev

Shaida Muhammad
  • 1,428
  • 14
  • 25
2

Try this once and let me know if it didn't solve

sudo apt-get install python3-dev
Sandeep Panchal
  • 385
  • 2
  • 3
  • 3
    No this doesn't work, because the version in the Ubuntu 20.04 repos is 3.8, but I need 3.7. – noel Aug 16 '20 at 00:06
  • So, you need a specific version. I found one site that says to try with 'sudo apt-get install python3.7-dev' Let me know if this worked. I will edit the answer if it worked correctly which can help others who is having the same issue. Check this site: https://zoomadmin.com/HowToInstall/UbuntuPackage/python3.7-dev – Sandeep Panchal Aug 16 '20 at 12:13
  • 4
    Yeap `sudo apt-get install python3.7-dev` did the trick. – Jimi Dec 17 '20 at 10:49
  • Is it possible to do the same with pyenv? – Eric Burel Jun 28 '21 at 07:52
  • @Jimi it worked perfectly. – Shaida Muhammad Dec 10 '21 at 03:36
-1

maybe you can use libpython3.7m-pic.a instead, which acts like libpython3.7.so to some extent