I get this error when I try to runserver
any of my projects while I'm running my virtual env (workon django1.2
)
the error :
ImportError: cannot import name "urandom"
after researching the issue I found this:
Warning Python bugfix releases 2.6.8, 2.7.3, 3.1.5 and 3.2.3 include a change that will cause “import random” to fail with “cannot import name urandom” on any virtualenv created on a Unix host with an earlier release of Python 2.6/2.7/3.1/3.2, if the underlying system Python is upgraded. This is due to the fact that a virtualenv uses the system Python’s standard library but contains its own copy of the Python interpreter, so an upgrade to the system Python results in a mismatch between the version of the Python interpreter and the version of the standard library. It can be fixed by removing $ENV/bin/python and re-running virtualenv on the same target directory with the upgraded Python.
but running ENV/bin/python
gives me :
bash: ENV/bin/python: No file or directory of this type
Where can I find my virtualen directory?
I understand very little about virtualenvs so please bear with me
thanks
You have to recreate your virtual environment.
My guess is that the following has happended:
The simplest fix is to delete your virtual environment and create a new one:
$ rm -r VIRTUALENVDIR
$ virtualenv VIRTUALENVDIR
$ . VIRTUALENVDIR/bin/activate
# then pip install any required packages, if your project has a requirements.txt file,
# this is simply:
$ pip install -r requirements.txt
# otherwise, you will have to install each package
$ pip install packagename
$ pip install packagename==version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With