2

I've two versions of Python installed. 3+ for Django and 2+ for Scrapy. I can use whatever version I want using the following method:-

py abc.py #for 2.+ use
py -3 abc.py  #for 3.+ use

The problem is that when I try to make a project with Scrapy

scrapy startproject news

How can I explicitly mention or force scrapy to use 2.+ python version. Currently, it is using 3.+ version. I can confirm this because it gives me an error at a certain "twisted" package, that Scrapy uses, which is only for python 2.+

Update:-

I'm using Windows environment.

Update:-

>where.exe scrappy
C:\Python34\Scripts\scrapy.exe
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
Omar Tariq
  • 7,536
  • 10
  • 38
  • 57

2 Answers2

2

The actual problem is that you have Scrapy installed into the Python 3.4. environment.

Install it into the Python 2.7 environment. If installed, you can check if scrapy points to the 2.7 "Scripts" directory or call it directly from Python 2.7 "Scripts".

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
0

All you have to do is type : #!/usr/bin/Python2.7
at the start of the text file It will execute using Python 2.7

Meghdeep Ray
  • 5,262
  • 4
  • 34
  • 58