0

对于几个月前使用 Scrapy 编写的项目之一,我无法使用 Ubuntu 作为基本操作系统构建 docker 映像。它显示以下依赖错误 -

Downloading/unpacking cryptography>=2.1.4 (from pyOpenSSL->Scrapy==1.4.0->-r /app/requirements.txt (line 3))
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
    error in cryptography setup command: Invalid environment marker: platform_python_implementation != 'PyPy'
    Complete output from command python setup.py egg_info:
    error in cryptography setup command: Invalid environment marker: platform_python_implementation != 'PyPy'

由于我无法控制 Scrapy 的依赖项,并且我一直在使用最新版本的 Scrapy 1.4.0 和 Python 3,我不确定我现在有什么选择?

以下是我用来安装依赖项的命令

pip3 install -r requirements.txt

以下是我的 requirements.txt 的样子

lxml==3.8.0
psycopg2==2.7.3.1
Scrapy==1.4.0
Twisted==17.5.0
validators==0.12.0
tweepy==3.5.0

更新:

该构建在 Mac 机器上运行良好,如下所示,而它在 Ubuntu 机器上不起作用。注意:即使是成功的构建也会发出platform_python_implementation != "PyPy"如下所示的警告 -

Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
  Downloading cffi-1.11.2-cp35-cp35m-macosx_10_6_intel.whl (240kB)
    100% |████████████████████████████████| 245kB 623kB/s
Collecting asn1crypto>=0.21.0 (from cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
  Downloading asn1crypto-0.23.0-py2.py3-none-any.whl (99kB)
    100% |████████████████████████████████| 102kB 830kB/s
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=2.1.4->pyOpenSSL->Scrapy==1.4.0->-r requirements.txt (line 3))
Building wheels for collected packages: zope.interface, oauthlib
  Running setup.py bdist_wheel for zope.interface ... done
  Stored in directory: /Users/rahul/Library/Caches/pip/wheels/8b/39/98/0fcb72adfb12b2547273b1164d952f093f267e0324d58b6955
  Running setup.py bdist_wheel for oauthlib ... done
  Stored in directory: /Users/rahul/Library/Caches/pip/wheels/e5/46/f7/bb2fde81726295a13a71e3c6396d362ab408921c6562d6efc0
Successfully built zope.interface oauthlib
4

1 回答 1

1

该问题与pip3升级有关。该软件包的一位贡献者在这里分享了提示

于 2017-12-14T07:56:56.670 回答