Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mkvirtualenv: command not found

I'm new to Python virtual environments, so after reading this tutorial I tried to create my first environment using virtualenvwrapper. My python3 installation is at the bare bones now:

$ pip3 list
argparse (1.2.1)
pip (1.5.6)
setuptools (2.1)
stevedore (0.15)
virtualenv (1.11.6)
virtualenv-clone (0.2.5)
virtualenvwrapper (4.3.1)

As suggested by the tutorial, I added the following lines to my .bashrc file:

export WORKON_HOME=$HOME/.virtualenvs
source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper_lazy.sh

which results in the following message when I open a new Terminal:

Last login: Wed Sep 10 22:33:17 on ttys006
-bash: _VIRTUALENVWRAPPER_API: unbound variable
-bash: VIRTUALENVWRAPPER_SCRIPT: unbound variable
-bash: VIRTUALENVWRAPPER_SCRIPT: unbound variable
-bash: _VIRTUALENVWRAPPER_API: unbound variable
-bash: _VIRTUALENVWRAPPER_API: unbound variable
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] [name ...]

I don't understand what the problem is, but clearly the source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper_lazy.sh line fails because then I can't even find the mkvirtualenv command:

$ mkvirtualenv test1 -p /usr/bin/python3.3
-bash: mkvirtualenv: command not found

I found this post and this one, with similar problems, but none of them gave me a solution.

like image 674
aaragon Avatar asked Sep 10 '14 20:09

aaragon


People also ask

How do I enable virtual environment in python?

To install virtualenv, just use pip install virtualenv . To create a virtual environment directory with it, type virtualenv /path/to/directory . Activating and deactivating the virtual environment works the same way as it does for virtual environments in Python 3 (see above).

What is Mkvirtualenv?

it's a linux command which is used to create virtual env. mkvirtualenv foo creates a new virtual env at your home directory. You may switch to that env by running workon foo on your linux terminal.

How do I install virtualenvwrapper on Windows?

To install, run one of the following: # using pip pip install virtualenvwrapper-win # using easy_install easy_install virtualenvwrapper-win # from source git clone git://github.com/davidmarble/virtualenvwrapper-win.git cd virtualenvwrapper-win python setup.py install # or pip install .

Where is virtualenvwrapper installed?

That installation installs virtualenvwrapper in the /usr/local/bin directory.


1 Answers

I added the following in my .bashrc, referring this

export PATH=/usr/local/bin:$PATH
source /usr/local/bin/virtualenvwrapper.sh

Now mkvirtualenv works-

pkoli@pkoli-SVE15136CNB:~/Desktop$ mkvirtualenv BUGS
Using base prefix '/usr'
New python executable in BUGS/bin/python3
Also creating executable in BUGS/bin/python
Installing setuptools, pip...done.
like image 92
pkoli Avatar answered Sep 28 '22 15:09

pkoli