我正在一台ubuntu机器上用scrapy运行一个我用python编写的scraping程序。安装了Scrapy。我可以导入到python没有问题,当尝试pip install scrapy
时
Requirement already satisfied (use --upgrade to upgrade): scrapy in /system/linux/lib/python2.7/dist-packages
当我试图从命令运行scrapy时,例如使用scrapy crawl ...
,我得到了。
The program 'scrapy' is currently not installed.
怎么回事?这些象征性的联系搞砸了吗?你有什么想法吗?
如果没有sudo,pip将安装到$HOME/.local/bin,$HOME/.local/lib等文件中。将以下行添加到~/.bashrc或~/.profile(或其他shell的适当位置)中:
然后打开一个新的终端或reload.bashrc,它应该会找到这个命令。
我也犯了同样的错误。在虚拟环境中运行scrapy解决了这个问题。
python3 -m venv env
source env/bin/activate
pip install scrapy
scrapy crawl your_project_name_here
例如,我的项目名是
kitten
,我在步骤4中执行了以下操作scrapy crawl kitten
注意:我是在运行Python 3+的Mac操作系统上完成的
我尝试了下面的
sudo pip install scrapy
,但是Ubuntu 16.04明确建议我已经安装了它。 我必须先使用sudo pip uninstall scrapy
,然后使用sudo pip install scrapy
才能成功安装它。 现在你应该可以成功地运行scrapy了。相关问题 更多 >
编程相关推荐