2017-10-07 57 views
0

所以我是Python新手,学习它的好方法是做一些个人项目:)所以我在我的Windows,并使用virtualenv遏制环境pip在Python 3中安装python模块,但该模块有一个依赖包,需要Python 2

所以,我需要使用杂凑模块:

pip install scrappy

Collecting scrappy 
    Using cached Scrappy-0.3.0.alpha.4.tar.gz 
Collecting guessit (from scrappy) 
    Using cached guessit-2.1.4.tar.gz 
Collecting tvdb_api (from scrappy) 
    Using cached tvdb_api-2.0.tar.gz 
Collecting hachoir-metadata (from scrappy) 
    Using cached hachoir-metadata-1.3.3.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 1, in <module> 
     File "C:\Users\USERPH\AppData\Local\Temp\pip-build-__zp7zbj\hachoir-metadata\setup.py", line 65 
     except OSError, err: 
        ^
    SyntaxError: invalid syntax 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in C:\Users\USERPH\AppData\Local\Temp\pip-build-__zp7zbj\h 
achoir-metadata\ 

其因hachoir-metadata是Python2依赖包,所以我尝试安装它们的p ython 3版

pip install hachoir3

我证实,它是使用

pip list | Select-String hachoir3

所以我试图运行

pip install scrappy再次

但同样的错误安装。

任何解决方法安装scrappy?我不能去Python 2.

谢谢!

回答

0

Scrappy本身contains code只适用于Python 2。 Scrappy不能与Python 3+一起使用。

+0

最终使用conda,并使用他们在conda-forge频道中的Scrapy。谢谢! –