Raspbian Buster has Python3.7 by default. I'm trying to make a Python3.6 virtualenv. I have a fresh install of Raspbian Buster with Desktop (not the version that is with "recommended software") and have already sudo apt-get update; sudo apt-get upgrade
'd.
- I have run
sudo apt-get install python3.6-dev
to get Python 3.6. - I then run
pip3 install virtualenvwrapper
and added the appropriate lines to my .bashrc. - When I run
mkvirtualenv --python=/usr/bin/python3.6 venv
it gives the following error
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/virtualenv.py", line 24, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
I have searched for answers already and nothing has helped. Here's what I've done (as far as I can remember).
- I tried adding
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.6
to my .bashrc and it didn't help. - I tried
python3.6 -m pip install virtualenvwrapper
and get another distutils error:Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/lib/python3/dist-packages/pip/__main__.py", line 16, in <module> from pip._internal import main as _main # isort:skip # noqa File "/usr/lib/python3/dist-packages/pip/_internal/__init__.py", line 40, in <module> from pip._internal.cli.autocompletion import autocomplete File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module> from pip._internal.cli.main_parser import create_main_parser File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module> from pip._internal.cli import cmdoptions File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module> from pip._internal.locations import USER_CACHE_DIR, src_prefix File "/usr/lib/python3/dist-packages/pip/_internal/locations.py", line 10, in <module> from distutils import sysconfig as distutils_sysconfig ImportError: cannot import name 'sysconfig'
- I can successfully do
mkvirtualenv venv
but of course that uses Python 3.7 which I don't want. - I tried
sudo apt-get install python3-distutils --reinstall
but it only seems to install the Python3.7 version. There is nopython3.6-distutils
package.
Anyone know anything about how to get this working?