Scrapy: use a specific python version
I tried to run scrapy in my centers. Since centos comes with python2.6 installed and scrapy requires python2.7, I tried to create a virtual environment and run scrapy inside it, but I still get the error
Scrapy 0.24.4 requires Python 2.7.
This is my result when running a spider
(scrapyproject)[imadmin@IM03 tutorial]$ python --version
Python 2.7.6
(scrapyproject)[imadmin@IM03 tutorial]$ scrapy gen_spider
Scrapy 0.24.4 requires Python 2.7
I even tried setting up a shell alias:
alias python=/usr/local/bin/python2.7
It didn't work either.
thank
source to share
The problem here is that the scrapy gen_spider command is looking for a scrapy installation that is outside of your virtualenv.
Modify your $ PATH to include the scrapy installation (which is inside your virtualenv) before everything else.
Example:
export PATH = / root / virtualenv-1.11.6 / localenv / bin: /root/virtualenv-1.11.6/localenv/lib/python2.7/site-packages: / usr / local / sbin: / usr / local / bin : / Sbin: / bin: / usr / sbin: / usr / bin: / root / bin
source to share