Naveenkumar A
Naveenkumar A

Reputation: 21

I'm not able create virtual environment using virtualenv

C:\Users\NAVEEN\Desktop\Demo>virtualenv venv

Traceback (most recent call last):
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\NAVEEN\AppData\Local\Programs\Python\Python38\Scripts\virtualenv.exe\__main__.py", line 4, in <module>
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\__init__.py", line 3, in <module>
    from .run import cli_run
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\__init__.py", line 12, in <module>
    from .plugin.activators import ActivationSelector
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\plugin\activators.py", line 6, in <module>
    from .base import ComponentBuilder
  File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\plugin\base.py", line 7, in <module>
    from importlib.metadata import entry_points
ModuleNotFoundError: No module named 'importlib.metadata'

Upvotes: 0

Views: 3143

Answers (3)

teddcp
teddcp

Reputation: 1624

In Python 3.6+, the pyvenv module is deprecated.Your python interpreter version is 3.8.

Use the following one-liner instead:

python3 -m venv <myenvname>

Python already ships with its builtin "virtualenv" called venv since version 3.3. You no longer need to install or download the virtualenv scripts for Python 3.3+.

Refer the doc for more and Another stackOverflow Answer

Upvotes: 2

Rok Klancar
Rok Klancar

Reputation: 65

You want to write it like this:

python -m venv {virtualenv}

replace '{virtualenv}' with the name you want your virtual environment to have.

Upvotes: 1

Fisrt install virtualenv Using comand pip install virtualenv Or pip3 install virtualenv(for linux) Then you can create a venv You can check version ov virtualenv using comand virtualenv --version

Upvotes: 0

Related Questions