I'm starting to use virtualenv and virtualenvwrapper on my projects.
After activating the virtualenv with the workon
command, i installed the following packages with pip install -U <package>
:
$ lssitepackages
django pip
Django-1.3-py2.7.egg-info pip-1.0.1-py2.7.egg-info
easy-install.pth setuptools-0.6c11-py2.7.egg
fabric setuptools.pth
Fabric-1.0.1-py2.7.egg-info south
geopy South-0.7.3-py2.7.egg-info
geopy-0.94.1-py2.7.egg-info
The problem here is (running commands with the virtualenv activated):
$ whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.7 /etc/python2.6 /etc/python /etc/python2.7 /usr/lib/python2.6 /usr/lib/python2.7 /usr/lib64/python2.6 /usr/lib64/python2.7 /usr/local/lib/python2.6 /usr/local/lib/python2.7 /usr/include/python2.6 /usr/include/python2.7 /usr/share/python /usr/share/man/man1/python.1.gz
$ whereis django-admin
django-admin: /usr/bin/django-admin /usr/local/bin/django-admin.py /usr/share/man/man1/django-admin.1.gz
$ whereis fab
fab: /usr/local/bin/fab
My virtualenv it's not using the local packages!
How do I force the virtualenv use local Python and local version of packges instead my machine packages?
Update - Possible solution
I created a new virtualenv with mkvirtualenv --no-site-packages <name>
and now I got these outputs:
$ which python
/home/user/.virtualenvs/VIRTUALENVNAME/bin/python
$ which django-admin
/usr/bin/django-admin
$ which django-admin.py
/home/user/.virtualenvs/VIRTUALENVNAME/bin/django-admin.py
$ which fab
/home/user/.virtualenvs/VIRTUALENVNAME/bin/fab
Sounds like it's working now... except for the "django-admin" command.
try install the virtualenv using:
mkvirtualenv --no-site-packages
to create the virtualenv without any external python libraries
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