0

I was having some problems with my environment so I reinstalled homebrew, python 3, and reset my $PATH. Now that I'm trying to pick up where I left off, I noticed that virtualenv isn't working like it had previously. When I run python3 -m venv ~/.venv/proj1 I get the following output

Error: [Errno 2] No such file or directory: '/Users/johnsmith/.venv/proj1/bin/python3': '/Users/johnsmith/.venv/proj1/bin/python3'.

This command was working fine prior to resetting everything. Is there something I'm overlooking?

David Jones
  • 4,766
  • 3
  • 32
  • 45
Brosef
  • 2,945
  • 6
  • 34
  • 69

2 Answers2

0

Try

rm -rf ~/.venv

and then recreate the venv

ic3b3rg
  • 14,629
  • 4
  • 30
  • 53
  • Tried doing that but I get a bunch of lines saying permission denied – Brosef May 30 '18 at 05:14
  • Whats the reason for removing venv? – Brosef May 30 '18 at 05:15
  • Try with `sudo` – ic3b3rg May 30 '18 at 05:15
  • Virtual environments are disposable by design. If your current venv has issues, the first diagnostic step should be to recreate it. 99% of the time, that will fix the issue. – ic3b3rg May 30 '18 at 05:18
  • Your solution worked but I'm a little confused about whats going on. When I run `python3 -m venv ~/.venv/proj1` I'm creating a virtual environment called proj1, right? – Brosef May 30 '18 at 05:24
  • Yes, and then you activate that environment for that project. You could also install the venv in the project's folder. – ic3b3rg May 30 '18 at 05:37
0

If you don't want to remove the virtualenv, see this post: Can I move a virtualenv?

Essentially you can just use mv as usual and the run sed -i -e 's|username/first|username/second|' my-venv/bin/activate (substitute the old location for username/first and the new location for username/second).

Jonas
  • 1,473
  • 2
  • 13
  • 28