So I installed venv for python and made a virtual environment called ftai_venv. However when I activate it I get an error
When I go into ftai_venv/bin, I don't see the activate bash file. Where would I get this?
The file should be there have you tried creating another virtual environment ?
Run below commands to create the virtual environment
On macOS and Linux:
python3 -m venv ftai_venv
source ftai_venv/bin/activate
for more detail check the link
Creating virtual environment in Windows
C:\Python>mkvirtualenv py1
C:\Users\176226\Envs is not a directory, creating
FileNotFoundError: [Errno 2] No such file or directory: 'c:\users\176226\anaconda3\Lib\venv\scripts\nt\python.exe'
This path exists: c:\users\176226\anaconda3\Lib\venv\scripts\nt\
And I do have python installed as well
Can someone please help
c:\users\176226\anaconda3\Lib\venv\scripts\nt\python.exe
The above path is of Python executable not the environment source file.
Assuming that you are using Python 3, you can follow the below steps to create and activate Python environment:
To create environment: python -m venv path/to/virtualenv
Example:
python -m venv .venv
The above command creates Python environment in current directory.
To activate the environment created in the previous step:
.venv\Scripts\activate
activate is the source script which activates the environment.
Pls. refer https://www.geeksforgeeks.org/creating-python-virtual-environment-windows-linux/ Windows section. If python is installed in your system, then pip comes in handy.
I'm trying to create and activate a virtual environment, using Windows 10 command prompt. I know that virtualenv is installed correctly, as the command
virtualenv venv
Works. I've navigated to my virtualenv download, Downloads\venv\Scripts, and am trying to activate my virtual environment venv. I've tried
venv activate
Which doesn't work since Windows doesn't recognize venv as a command. I've also tried
virtualenv venv activate
Which also doesn't work since virtualenv is saying that "venv activate" isn't a valid argument.
Use the activate script in the Scripts directory of your virtual environment:
> venv\Scripts\activate
This will activate your virtual environment and your terminal will look like this depending on the directory you're in:
(venv) C:\Users\acer\Desktop>
I hope this helps!
If you're using virtualenvwrapper-win, and using the DOS command prompt (as opposed to e.g. Powershell), then new virtualenvs are created using:
mkvirtualenv myenv
and activated using
workon myenv
You should define the environment variable WORKON_HOME to point to where you want you virtualenvs to reside.
If you've installed virtualenvwrapper-win>=1.2.4 then the virtualenvwrapper command will give you a list available commands:
go|c:\srv> virtualenvwrapper
virtualenvwrapper is a set of extensions to Ian Bicking's virtualenv
tool. The extensions include wrappers for creating and deleting
virtual environments and otherwise managing your development workflow,
making it easier to work on more than one project at a time without
introducing conflicts in their dependencies.
virtualenvwrapper-win is a port of Dough Hellman's virtualenvwrapper to Windows
batch scripts.
Commands available:
add2virtualenv: add directory to the import path
cdproject: change directory to the active project
cdsitepackages: change to the site-packages directory
cdvirtualenv: change to the $VIRTUAL_ENV directory
lssitepackages: list contents of the site-packages directory
lsvirtualenv: list virtualenvs
mkproject: create a new project directory and its associated virtualenv
mkvirtualenv: Create a new virtualenv in $WORKON_HOME
rmvirtualenv: Remove a virtualenv
setprojectdir: associate a project directory with a virtualenv
toggleglobalsitepackages: turn access to global site-packages on/off
virtualenvwrapper: show this help message
whereis: return full path to executable on path.
workon: list or change working virtualenvs
From the directory where you have your virtual environment (e.g. myenv)
you need to run the following command: .\myenv\Scripts\activate
Go to the folder where you have created the virtual environment in cmd and
enter the command .\venv\Scripts\activate
It will activate the virtual env in windows
from the command (cmd) prompt:
call venv/Scripts/activate
Make sure the Python Scripts folder is in your environment variables.
Usually the path is: "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\Scripts"
(Change "admin" to your windows username and "Python37-32" path according to your python version)
When you use "virtualenv" to create an env, it saves an "activate.bat" file in the scripts folder originating from the directory you ran the first command. E.g if you ran the command virtualenv env from C:/Users/Name/Documents/..., the .bat will be located in C:/Users/Name/Documents/.../env/scripts/activate.bat. You can run it from there.
Simply you can activate your virtualenv using command: workon myenvname
You can also create a command-line script like this -
#echo off
CD\
CD "C:\Users\[user name]\venv\Scripts"
start activate.bat
start jupyter notebook
Save this in a notepad file with an extension ".cmd".
You are ready to go
if you have anaconda installed then open anaconda terminal and type
> conda env list # for list of environment you already have
> conda activate {env_name} # to activate the environment
This works for me from Anaconda prompt,
.\\myvenv\\Scripts\\activate.bat
start python 3.7
python -m virtualenv
"You must provide a DEST_DIR"
python -m venv demodjango("demodjango is file name)"
activate.bat
pip install django
django-admin.py startproject demo1 (demo1 is my project)
python manage.py runserver
Performing system checks...
After doing this on a command prompt, you will get an URL. Click on that and you will see a message in the browser window that Django has been properly installed.
Using command prompt, trying to create a virtual environment.
Here is the prompt I am typing in:
C:\Users\Eric>cd d3stryr-3stripes-master
C:\Users\Eric\d3stryr-3stripes-master>virtualenv -p python3 --no-site-packages env
The error is:
The path python3 (from --python=python3) does not exist
I am completely lost as to why this doesn't exist.
This will change depending on where you installed python on your system but will look something like this.
virtualenv -p "C:\Program Files\Python 3.5\python.exe" --no-site-packages myvenv
I am currently learning Flask and to do so I have to install virtualenv. It installs it normally but after that I have to activate the environment. In the tutorial it says that I have to type this into CMD:
venv\scripts\activate
It gives me the error: "The system cannot find the path specified".
I tried to run this and it doesn't work either:
venv\Scripts\activate.bat
Any help will be really appreciated.
First make sure where your working directory of your project is,lets say you have your venv in a directory called FolderX. Go to the directory's location, hold shift and right click on it then click on "Open terminal here" from the right click option.Now that you have terminal/cmd opened in that directory, type in venv\Scripts\activate.bat or venv\Scripts\activate. Do make sure that you have activate.py or activate.bat in the specific path.
You can also try this if not installed:
pip install virtualenv
If you have it installed,create another virtual environment for the project.Type these in your terminal:
cd my_project_folder
virtualenv venv
venv/bin/activate