简体   繁体   English

在Python VirtualEnv上安装Scrapy

[英]Installing Scrapy on Python VirtualEnv

Here's my problem, I have a shared hosting (GoDaddy Linux Hosting package) account and I'd like to create .py file to do some scraping for me. 这是我的问题,我有一个共享的托管(GoDaddy Linux托管软件包)帐户,我想创建.py文件为我做一些抓取工作。 To do this I need the scrapy module (scrapy.org). 为此,我需要scrapy模块(scrapy.org)。 Because of the shared account I can't install new modules so I installed VirtualEnv and created a new virtual env. 由于共享帐户,我无法安装新模块,因此我安装了VirtualEnv并创建了一个新的虚拟环境。 that has pip, wheel, etc. preinstalled. 预先安装了pip,wheel等。

Running pip install scrapy does NOT complete successfully because scrapy has lot of dependencies like libxml2 and it also needs python-dev tools. 运行pip install scrapy不会成功完成,因为scrapy具有很多类似libxml2的依赖项,并且还需要python-dev工具。 If I had access to 'sudo apt-get ...' this would be easy but I dont'. 如果我可以访问“ sudo apt-get ...”,这会很容易,但我不会。 I can only use pip and easy_install. 我只能使用pip和easy_install。

So How do I install the python dev tool? 那么,如何安装python dev工具? And how do I install the dependencies? 以及如何安装依赖项? Is this even possible? 这有可能吗?

Cheers 干杯

You can install all the dependencies by activating the python virtual environment first. 您可以通过首先激活python虚拟环境来安装所有依赖项。 Step 1 : On Linux : env/bin/activate On Windows : env\\Scripts\\activate Step 2: pip install lxml 步骤1:在Linux上: env/bin/activate在Windows上: env\\Scripts\\activate步骤2: pip install lxml

I just tried and it worked for me. 我只是尝试了,对我有用。 Please find screen shot attached. 请找到所附的屏幕截图。

在python虚拟环境中安装pip

在GoDaddy计划中做我想做的事是不可能的。

I had some of the same issues. 我有一些相同的问题。 I found this and modified to pip3.7 install lxml==3.4.2 . 我发现了这一点,并修改为pip3.7 install lxml==3.4.2 I was able to install successfully. 我能够成功安装。

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

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