-1

So, this answer is, in theory, already out there. However, after reading a bunch of questions on SO, I am still at a loss of how exactly to get a fresh / clean virtualenv up and running. The problem appears to be some variation on the fact that I have added PYTHONPATH to my system environment. What I'd like to do, is remove that for the purposes of the virtualenv. Unfortunately, I have no idea how to do that:

  1. What file do I edit?
  2. Where?
  3. Is there a way to do this so that, in the future when I start a virtualenv, I don't have to similarly edit whatever I'm going to have to edit to fix this problem (this problem has been happening for long enough that I imagine it has been solved)?
  4. Should I be using virtualenvwrapper to help me here (I've seen that referenced in respect of this problem a number of times)?
  5. Generally: halp?

As I understand it, the steps are:

  • Install virtualenv: check
  • Create a virtualenv using the --no-site-packages flag: check
  • pip freeze: what the? All these packages!!
  • figure out how to remove PYTHONPATH from virtualenv: I have no idea.
Community
  • 1
  • 1
NotAnAmbiTurner
  • 2,553
  • 2
  • 21
  • 44

3 Answers3

1

Have you entered the virtualenv before pip freeze?

virtualenv --no-site-packages .venv  # create virtualenv
source .venv/bin/activate  # enter virtualenv

Edit

If you want to change environmental variable in your virtualenv, you can try editing virtualenv's activate script. It is located in virtualenvdir/bin/activate

  • ya, I did that... no dice sadly. If you look at the linked posts, it's not a unique problem, I just don't know how to 'do' the solution(s). – NotAnAmbiTurner Nov 16 '15 at 06:28
1

There's also a bug where spaces in any directories leading to your virtual environment will cause pip to not be found

Kingswell
  • 116
  • 1
  • 2
0

It turns out that there is a virtualenv bug when you have a $ in the path name. Who knew?

NotAnAmbiTurner
  • 2,553
  • 2
  • 21
  • 44