Under Ubuntu, py2 and PY3 coexist, / usr / bin / Python: no module named virtualenvwrapper error resolution

Geeks, please accept the hero post of 2021 Microsoft x Intel hacking contest>>>

In Ubuntu, py2 and PY3 coexist

Running virtualenvwrapper will report the following error:

/usr/bin/python: No module named virtualenvwrapper

My virtual env wrapper is actually installed in python3, but not in python2

However, the script of virtualenvwrapper still uses/usr/bin/Python by default. We need to modify it to/usr/bin/Python 3 by default.

in the ~ /. Bashrc file, before source/usr/local/bin/virtualenvwrapper.sh, add:

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

That is to say, the paragraph about virtualenvwrapper.sh is modified as follows:

if [ -f /usr/local/bin/virtualenvwrapper.sh ]; then
    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export WORKON_HOME=$HOME/.virtualenvs
    source /usr/local/bin/virtualenvwrapper.sh

Similar Posts: