I have a python2.7 virtual environment already setup for an existing project but now I need to have a python3 virtual environment setup too.
The command that I am using to achieve this is (I already have python3 installed):
which python3 returns /usr/bin/python3
mkvirtualenv --python=/usr/bin/python3 nameOfEnvironment
However, when I run the above command I get the error,
Running virtualenv with interpreter /usr/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 24, in <module>
import distutils.spawn
ModuleNotFoundError: No module named 'distutils.spawn'
How do I fix this problem and why is it looking at python2.7 when I've specified python3? Does it have anything to do with the existing python2.7 virtual environment?