How to Install Scrapy along with Virtual Environment

Scrapy is a Python module and in order to use it, we first need to install python on our Computer/Laptop.

If python is already installed on your machine then you can Go ahead and start installing Scrapy on your Computer, If not then you can Read How to Install Python in windows, MAC, Linux, Android, or iOS operating systems.

How to install Scrapy with Virtual enviroment

If you are not sure whether python is installed or not in your computer simply open the command prompt and type the following command there.

python -V

If it is installed you will see the latest python version, If not it’ll display the error there.

Installing and setting up a virtual environment

It’s always a good idea to make a virtual environment for each of your different projects. In that way, you will know which modules you actually need in case you want to deploy to the server or something like this.

One of the simplest ways to use virtualenv to create a virtual environment.

  1. In your command prompt or PowerShell type this command for virtualenv installation.
pip install virtualenv
  1. This command will install virtualenv and all of its dependencies.
  1. Now it’s time to set up new virtualenv. To do this use this command.
    virtualenv virtual_workspace 
  2. cd to virtual_workspace that we just created.
  3. Now to activate type this command
    Scripts\activate
    

How to Install Scrapy

  1. Make sure the virtual environment that we created is active. If not activate it.
  2. Use this pip command to install Scrapy in your virtual environment.
    pip install scrapy
    
  3. Wait till the Scrapy will install and once it does you can import and use its all of the features available.

Creating Scrapy project

  1. Once the scrapy is installed, Now we can create the scrapy project on our computer.
  2. Navigate to the folder where you want to create a project in your terminal and type this command to create a project.
    scrapy startproject myproject
    
  1. Simply replace the project with the name of the project that you want.
  2. Now open our newly created project folder inside the Code editor of your choice and you can start working.

I'm Rahul Bodana, Writer by day, YouTuber by night, coder when the coffee kicks in, and trader when I want to test the limits of my stress tolerance.

Report Your Issue Here or Leave Query