-1

I'm normally a unix/Mac person, so I'm not exactly sure how this might be related, but one of my users is on a windows box (windows 7?) running via cmd command line.

I have a virtualenv set up for windows, on this one system (other computers work fine) I can start the virtualenv (activate.bat) and when I run python from within the venv/Scripts directory, things look fine. my sys.path is correct.

When I cd .., and run python again (or run python from anywhere else), the sys.path is what sys.path would be if I weren't in the virtualenv.

I still have the (venv) prepended to my prompt, so venv THINKS it's still active...

correct sys.path:

['', 'C:\\Windows\\system32\\python27.zip', 
'C:\\Users\\dellam\\Dropbox (CEP)\\users\\brianp\\course\\CYAN\\venv\\DLLs', 
'C:\\Users\\dellam\\Dropbox (CEP)\\users\\brianp\\course\\CYAN\\venv\\lib', 
'C:\\Users\\dellam\\Dropbox CEP)\\users\\brianp\\course\\CYAN\\venv\\lib\\plat-win', 
[ETC]]

sys.path from anywhere other than venv\Scripts:

sys.path

['', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 
'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 
'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 
'C:\\Python27\\lib\\site-packages']

I'm using virtualenv correctly. At least, it works on other computers. I'm correctly creating a venv, and I'm activating it. It has the (venv) appended to my prompt. The question people are linking to explains how to use virtual env. I'm doing all of that correctly.

Brian Postow
  • 11,709
  • 17
  • 81
  • 125
  • This has possibly been answered before in [this question](http://stackoverflow.com/questions/4527958/python-virtualenv-questions) - Can you check it out and see? There should also be a `deactivate.bat` - are you running that to get out of the venv? – sytech Jul 12 '16 at 19:56
  • I'm activated. I've run activate.bat, and the (venv) is in my command line, but the sys.path isn't correct, unless I'm running python from venv/Scripts. I believe I'm using venv correctly, because it works on other systems... – Brian Postow Jul 12 '16 at 19:59
  • What do you get for `where python` in the Scripts directory versus other directories? – Eryk Sun Jul 12 '16 at 21:43
  • in both cases, it's C:\python27\python.exe – Brian Postow Jul 12 '16 at 21:53
  • Don't you have a venv/Scripts/python.exe? If so `where` should at least find it first when the Scripts directory is the current directory. – Eryk Sun Jul 12 '16 at 21:58

1 Answers1

0

Apparently the problem is that my code and the virtualenv live on dropbox. which means that it gets copied to each new computer. The fact that it worked in powershell on a 2nd computer was just a fluke... Now I need to figure out a better way to do this in the first place... sigh

Brian Postow
  • 11,709
  • 17
  • 81
  • 125
  • I was going to say -- As a Windows user, I've had more luck with powershell than trying any other method. Hope you figure out a solution to your implementation. – sytech Jul 13 '16 at 12:27