so i have a fresh debian install. I installed pythons 3.5,3.6,3.7:
root@m2:~# apt-get install python3.{5,6,7}-dev
and try to set up some virtualenvs:
for i in 5 6 7 ; do dir=venv3.$i; echo $dir; mkdir $dir; virtualenv $dir --python=python3.$i; done
result:
-------------
venv3.5
Running virtualenv with interpreter /usr/bin/python3.5
Using base prefix '/usr'
New python executable in /root/venv3.5/bin/python3.5
Also creating executable in /root/venv3.5/bin/python
Installing setuptools, pip, wheel...done.
-------------
venv3.6
Running virtualenv with interpreter /usr/bin/python3.6
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 25, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
-------------
venv3.7
Running virtualenv with interpreter /usr/bin/python3.7
Using base prefix '/usr'
/usr/local/lib/python2.7/dist-packages/virtualenv.py:1047: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
New python executable in /root/venv3.7/bin/python3.7
Also creating executable in /root/venv3.7/bin/python
Installing setuptools, pip, wheel...done.
any idea how to fix this for python 3.6?
the exact version is:
root@m2:~# dpkg-query -s python3.6
Package: python3.6
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 326
Maintainer: Matthias Klose <doko@debian.org>
Architecture: amd64
Multi-Arch: allowed
Version: 3.6.8-1
Meanwhile, on some older system I also have debian 8 and python3.6, and there it works ok:
root@m1:~# dpkg-query -s python3.6
Package: python3.6
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 315
Maintainer: Matthias Klose <doko@debian.org>
Architecture: amd64
Multi-Arch: allowed
Version: 3.6.6-4
root@m1:~# virtualenv venv3.6 --python=python3.6
Running virtualenv with interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in /root/venv3.6/bin/python3.6
Also creating executable in /root/venv3.6/bin/python
Installing setuptools, pip, wheel...
done.
distutils
package is supposed to be for Python 3.6, e.g. by runningpython3.6 -c 'import distutils; print(distutils.__file__)'
and replace its contents with the files used by Python 3.7 (which appears to be working in your case). – Peter Bašista Jan 31 '19 at 10:51