1

Python3 showing error while trying to create a new virtual environment from terminal using

virtualenv name_goes_here 

with error,

Traceback (most recent call last): File "/home/w3e/.local/bin/virtualenv", line 7, in from virtualenv import main ImportError: cannot import name 'main' from 'virtualenv' (/usr/lib/python3/dist-packages/virtualenv/init.py)

But it works when I do it from PyCharm > Settings > Project Interpreter > Add Python Interpreter See the attached image below-

enter image description here

4
  • Did you try creating your virtual environment using builtin venv module? Commented Sep 6, 2020 at 17:04
  • No I didn't try with venv Commented Sep 6, 2020 at 17:05
  • I think pycharm uses venv to create the environment because virtualenv is a 3rd party tool. Commented Sep 6, 2020 at 17:09
  • 1
    In case you don't know, the command is python3 -m venv name_goes_here. Commented Sep 6, 2020 at 17:10

1 Answer 1

2

The command you were using doesn't exist.

Try this instead:

python3 -m venv your_venv 

And activate it using:

source your_venv/Scripts/activate 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.