简体   繁体   English

'scrapy' 安装后不被识别为内部或外部命令

[英]'scrapy' is not recognized as an internal or external command after installation

I am using python version 3.7.我正在使用 python 3.7 版。 I installed the package scrapy using the command pip install scrapy which got installed along with other dependencies successfully.我安装了 package scrapy 使用命令pip install scrapy成功安装了其他依赖项。

I then ran the command scrapy startproject newproject , this resulted into an error that reads 'scrapy' is not recognized as an internal or external command, operable program or batch file .然后我运行命令scrapy startproject newproject ,这导致错误读取'scrapy' is not recognized as an internal or external command, operable program or batch file

I also ran the command scrapy on the command line, it gave the same error.我还在命令行上运行了命令scrapy ,它给出了同样的错误。

Note : when I ran the command pip list , scrapy was among the installed packages.注意:当我运行命令pip list时,scrapy 在已安装的软件包中。

How can i fix this please?请问我该如何解决?

So, I was able to solve the method using two different methods :因此,我能够使用两种不同的方法来解决该方法

The first method includes the following:第一种方法包括以下内容:

  1. I installed it using anaconda with the command conda install -c conda-forge scrapy , and then activated the conda environment using conda activate.我使用 anaconda 和命令conda install -c conda-forge scrapy scrapy 安装它,然后使用 conda activate 激活 conda 环境。
  2. After running scrapy startproject newproject this time, it worked successfully.这次运行scrapy startproject newproject后,运行成功。

Note : You need to have anaconda or miniconda installed for this to work successfully.注意:您需要安装 anaconda 或 miniconda 才能成功运行。

The second method includes the following:第二种方法包括以下内容:

  1. I created a virtual environment using the command python -m venv venv and then activated it using the command venv\scripts\activate .我使用命令python -m venv venv创建了一个虚拟环境,然后使用命令venv\scripts\activate它。
  2. I ran the command pip install scrapy .我运行了命令pip install scrapy I got an error here error: can't find Rust compiler , i was using the pip version: 19.0.3.我在这里遇到错误error: can't find Rust compiler ,我使用的是 pip 版本:19.0.3。 So I solved the issue by upgrading the pip version by using th command pip install --upgrade pip which upgraded it to the version pip 21.1.2 So I solved the issue by upgrading the pip version by using th command pip install --upgrade pip which upgraded it to the version pip 21.1.2
  3. so after running the pip install scrapy command again, it worked successfully.因此,在再次运行pip install scrapy命令后,它成功运行。

Throughout the whole process I noticed that, the scrapy command didn't work without being activated in a virtual environment even though the installation worked.在整个过程中我注意到,scrapy 命令没有在虚拟环境中激活就无法工作,即使安装成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM