`which python` in virtualenvwrapper.sh spins in arch linux

In arch linux, after installing virtualenvwrapper on a system scale, through sudo pip2 install virtualenvwrapperand adding this to my custom .bash_profile,

 export WORKON_HOME=/home/myuser/.virtualenvs
 export PROJECT_HOME=/home/myuser/work
 source /usr/bin/virtualenvwrapper.sh

Error every time you start a new shell window: -

which: no python in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin/core_perl)
-bash: : command not found
virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenv has been installed for VIRTUALENVWRAPPER_PYTHON= and that PATH is set properly.

This can be traced back to line 50 in the virtualenvwrapper.sh script file: -

 47 # Locate the global Python where virtualenvwrapper is installed. 
 48 if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] 
 49 then 
 50     VIRTUALENVWRAPPER_PYTHON="$(\which python)" 
 51 fi 

And this is the result of a conflict with the agreement with linux linux to use python2 to install python 2.7.

If I change line 50 to which python2everything works fine, and I will not see an error message whenever I start a new shell.

? , - linux if-else python2 virtualenvwrapper.sh virtualvvrapper? -, linux?

+3
3

python quirk ( python2), ​​ : -

ln -s /usr/bin/python2 /usr/local/bin/python

/usr/local/bin /usr/bin PATH bash, python virtualenvwrapper.sh script which python 50, virtualenvwrapper, , .

, "python 3" ( python ). , python 3 , python 3, .

+2

Virtualenvwrapper VIRTUALENVWRAPPER_PYTHON VIRTUALENVWRAPPER_VIRTUALENV, python virtualenv. , .bash_profile - :

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv2
source /usr/bin/virtualenvwrapper.sh
+3

, /usr/bin/virtualenvwrapper.sh script . virtualenvwrapper python2. :

pip2 install virtualenvwrapper

and kept the export so that the magic was done.

+1
source

All Articles