Uwsgi - do not use python2.7.3 from virtualenv, but using 2.6 from venv, although 2.6 is installed only globally

My system (ubuntu) has a version of python 2.6.5 (globally installed in / usr / bin /).
I want to use python 2.7.3.
To do this, I tried to create virtualenv using this answer. Is it possible to install another version of Python in Virtualenv? (did not make any sympathetic answers). I succeeded, and when I activated env and used the "python manage.py shell", it worked fine.

The problem is this: We use uwsgi to start the server. So far, we have directly used system python (2.6.5). When I installed everything new in virtualenv, I added a parameter

'-H /path/to/virtualenv' 

when starting the uwsgi server.

I got an error "there is no module named" os "during the execution of the line" import os ". (An error was found from the error logs)

So, I added import sys; print sys.path before the "import os" command. Then, when he typed the path, he had something like:

  /home/name/venv/bin/python/lib/python2.6/ #(one of the items in the array sys.path) 

But, when I looked at my folder in venv, there is nothing like python2.6 in the "lib" folder. , My lib folder from venv contains only "python2.7".

My requirement: uwsgi should use python 2.7 (from venv) and not 2.6 (global).

Also, in my sh file, I used the "what python" command, which showed me that it was using the global version. So, I must first tell the shell file to use python from virtualenv, and not the default global one. I tried 'source / path / to / activate' but the specified command was not found.

+6
source share
1 answer
  • Activate virtualenv ,
  • Install uwsgi : pip install uwsgi
  • Run uwsgi from virtualenv.
+9
source

All Articles