-1

when I am writing ' import scrapy ' to import this library in my python file, on running it is giving error "ModuleNotFoundError: No module named 'scrapy'" and i have also installed scrapy using

pip install scrapy


#enter code here
import bs4 as bs
import urllib.request
import scrapy


i = input('enter the item to be searched :')
i = i.replace(" ","")
sauce1 = urllib.request.urlopen('https://www.amazon.in/s/ref=nb_sb_noss? 
url=search-alias%3Daps&field-keywords='+i).read()
soup1 = bs.BeautifulSoup(sauce1,'lxml')

s_url = []

ul_parent = soup1.find('div', class_='a-row s-result-list-parent-container')    

for url in ul_parent.find_all('a'):
    if "javascript" not in str(url.get('href')):
        s_url.append(str(url.get('href')))
print(s_url)

what should I do to import scrapy as I want to extract items from Amazon website using "response.xpath". Please help Thank You

3 Answers3

0

you would have not installed Scrapy.

Please check in the installed list of libraries to verify the same by pip list

for installation details you can refer: here

Aneesh Damodaran
  • 566
  • 4
  • 10
0

1.Install Scrapy for your python version

    pip install scrapy

2. And then import it into your python file

    import scrapy
Meghana Goud
  • 111
  • 1
  • 9
  • I have tried this... I have installed scrapy . it is working in its project that is created by "create scrapyproject name" – Ishan Verma Jun 25 '18 at 11:16
  • navigate to your Python/Scripts path and run pip freeze or pip list and check whether your scarpy is installed or not.@Ishan Verma – Meghana Goud Jun 26 '18 at 05:19
  • it is not showing scrapy in pip list. buti hv installed it. now what should i do to place it on that list Now i tried to install scrapy in my Python/Scripts folder by setting path in cmd and i am getting error "error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools" - @Meghana Goud – Ishan Verma Jun 26 '18 at 17:57
  • check this [link](https://stackoverflow.com/questions/29846087/microsoft-visual-c-14-0-is-required-unable-to-find-vcvarsall-bat) try to upgrade your setup tools and check whether Python/Scripts is added to your system path (environmental variables) – Meghana Goud Jun 27 '18 at 05:05
0

Please try to install scrapy using pip install scrapy and try to import scrapy.

Mahesh D
  • 29
  • 7
  • I have tried this... I have installed scrapy . it is working in its project that is created by "create scrapyproject name" – Ishan Verma Jun 25 '18 at 11:16