hi i have installed virtualenv python library to manage my env doing all the setup but when i use the following command to open my env that happen
francesco#AirdiFrancesco ~ % workon
zsh: command not found: workon
but when i run this code before workon don't give me problems
export WORKON_HOME=~/Envs
VIRTUALENVWRAPPER_PYTHON=$(which python3)
source /opt/homebrew/bin/virtualenvwrapper.sh
now i have tried to add this three line to my ~/zshch file but doesn't work. where i need to put this code in my bash?
Related
When i have python 3.5 and python 3.6 on ubuntu .I entered some alternate commands to use python 3.5 only (when I type python -V and python3 -V the same output is 3.5.2)
And then i install virtualenv and virtualenvwrapper — these packages allow me to create and manage Python virtual environments:
$ sudo pip install virtualenv virtualenvwrapper
$ sudo rm -rf ~/get-pip.py ~/.cache/pip
To finish the install of these tools, I updated our ~/.bashrc file.I added the following lines to your ~/.bashrc :
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
Next, source the ~/.bashrc file:
$ source ~/.bashrc
And final I created your OpenCV 4 + Python 3 virtual environment:
$ mkvirtualenv cv -p python3
i have created the virtual environment but had some problems in the back end and i guess it was due to the presence of python3.6. In the end i decided to uninstall python 3.6 and rerun the steps above from scratch and had a problem at the last step that I mentioned above.When i enter command "mkvirtualenv cv -p python3" i get an ERROR:
FileExistsError: [Errno 17] File exists: '/usr/bin/python' -> '/home/had2000/.virtualenvs/cv/bin/python'
At the same time when i enter the command "update-alternatives --config python" python3.6 is no longer there,but i get a warning:
update-alternatives: warning: alternative /usr/bin/python3.6 (part of link group python) doesn't exist; removing from list of alternatives
There is 1 choice for the alternative python (providing /usr/bin/python).
Looking forward to your help, thank you
From the commands you've shared, the error arises from the mkvirtualenv cv being run twice - i.e. the environment already exists. To remove the environment you created, do: rmvirtualenv env-name-here which in this case will become rmvirtualenv cv. This shouldn't be done with that environment active, BTW. An alternate route is to delete $WORKON_HOME/env-name-here. By default, $WORKON_HOME is usually .virtualenvs.
I am new to cmder, when ever I try to create virtualenv for python, django and activate it using ./Scripts/activate
This is cmder :
F:\python\django\tweeter
λ .\Scripts\activate
F:\python\django\tweeter
λ
This is Git bash :
Ahmed#DESKTOP-VJ37FJE MINGW64 /f/python/django/tweeter
$ source ./Scripts/activate
(tweeter)
Ahmed#DESKTOP-VJ37FJE MINGW64 /f/python/django/tweeter
$
(tweeter)
Ahmed#DESKTOP-VJ37FJE MINGW64 /f/python/django/tweeter
$
As you can see when I use Git bash, it shows me virtualenv name when I activate it. But it not goes same for cmder.
When I trying to activate virtual environment using venv, pipenv and conda I always getting this error:
venv/bin/activate:41: parse error near `deactivate'
There's content of activate file:
Activate
I had exacly same issue. It was conflicting alias in my case.
I had alias fi="flatpak install --user" in my ~/.zshrc.
When I commented that, command worked like this:
$ fi
zsh: parse error near `fi'
and source venv/bin/activate worked correctly
I am competing in the HWO2014, yet I cannot run my bot. Here is the build file I was provided with, alongside the run file:
build:
#!/bin/bash
virtualenv env --no-site-packages --distribute
source env/bin/activate
run:
#!/bin/bash
source env/bin/activate
python main.py "$#"
However, when I run ./build on the MinGW terminal, the following error is reported:
./build: line 3: virtualenv: command not found
./build: line 5: env/bin/activate: No such file or directory
What does this error mean? How do I prevent it?
You need to install virtualenv on your machine. The run file is a bash script which is saying to go into the newly created virtual environment before running the python script. More info can be found on the official virtualenv docs.
I trying install virtualenvwrapper from your official guide http://virtualenvwrapper.readthedocs.org/en/latest/install.html
I install virtualenvwrapper with pip and when I define the environment variables and source
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
I reboot my shell and I get the following output.
bgarcial#el-pug:~$ bash
/usr/local/bin/python: No module named virtualenvwrapper
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=/usr/local/bin/python and that PATH is
set properly.
bgarcial#el-pug:~$
Despite this, the commands mkvirtualenv and others works. But .. What does this mean? How I can fix it? Thanks
What is the content of your ~/.bashrc file?
You may be calling "virtualenvwrapper" instead of "virtualenvwrapper.sh"
OR:
You may be exporting variables for the current shell that don't persist or propagate to subsequent shells.
The following script will install virtualenvwrapper and configure bash to persist the environment variables, which should in turn make virtualenvwrapper work as expected.
pip install virtualenvwrapper
configure_bashrc(){
echo '
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
' >> ~/.bashrc
source ~/.bashrc
}
[[ -z $(grep virtualenv ~/.bashrc) ]] && configure_bashrc