Tuesday, February 1, 2022

[SOLVED] Creating a new virtualenv in Python using command line?

Issue

I've been trying to set up a virtual environment going by the documentation and several href="http://tinwhiskers.net/setting-up-your-python-environment-with-pip-virtualenv-and-pycharm-windows/" rel="nofollow noreferrer">tutorials using Python version 3.6.1 downloaded through Anaconda on Windows 10. I've set up my PATH environment variables as follows:

C:\Users\...\Anaconda3\ 
C:\Users\...\Anaconda3\Lib\site-packages\
C:\Users\...\Anaconda3\Scripts\

So far I've used the following commands...

pip install virtualenv
pip install virtualenvwrapper-win

However, when I attempt to make the actual directory using:

virtualenv my_venv

Instead of creating a directory I get the standard list of options:

You must provide a DEST_DIR
Usage: virtualenv.py [OPTIONS] DEST_DIR

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity.
  -q, --quiet           Decrease verbosity.
  -p PYTHON_EXE, --python=PYTHON_EXE

[...]

I believe what I'm supposed to be seeing instead is something like:

New python executable in C:Users\...

Any suggestions on what I may be doing wrong? Thank you.


Solution

Anaconda uses conda to manage virtual environments. You can simply create a new environment by conda create -n env_name [python=x[.x]].

And activate a environment by activate env_name, deactivate a environment by deactivate.



Answered By - Sraw
Answer Checked By - Mary Flores (WPSolving Volunteer)