Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrapy: Use particular python version

I tried to run scrapy in my centOs. Since centos comes with python2.6 installed and scrapy requires python2.7, I tried creating virtual environment and ran scrapy inside that, but I still get error

Scrapy 0.24.4 requires Python 2.7.

These are my output on starting the 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

This also didnt work.

Thanks

like image 730
cyn0 Avatar asked Mar 07 '26 17:03

cyn0


1 Answers

You have to install scrapy inside the virtual environment (i.e. run pip install scrapy after activating virtual env "scrapyproject").

The way you are doing it now, scrapy command cannot be found inside virtual env, so it is called outside of virtual env.

P.S. Delete the alias.

like image 70
Bartosz Marcinkowski Avatar answered Mar 10 '26 07:03

Bartosz Marcinkowski