我在终端输入:
$ scrapy startproject tutorial
我无法开始一个新的scrapy项目,并且我会继续安装scrapy需要的所有东西。我无法让它发挥作用。这是它给我的错误信息:
File "/Users/carterdavis/anaconda/bin/scrapy", line 4, in <module>
execute()
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 122, in execute
cmds = _get_commands_dict(settings, inproject)
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 46, in _get_commands_dict
cmds = _get_commands_from_module('scrapy.commands', inproject)
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 29, in _get_commands_from_module
for cmd in _iter_command_classes(module):
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/cmdline.py", line 20, in _iter_command_classes
for module in walk_modules(module_name):
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/utils/misc.py", line 68, in walk_modules
submod = import_module(fullpath)
File "/Users/carterdavis/anaconda/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/commands/bench.py", line 3, in <module>
from scrapy.tests.mockserver import MockServer
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/scrapy/tests/mockserver.py", line 6, in <module>
from twisted.internet import reactor, defer, ssl
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/twisted/internet/ssl.py", line 25, in <module>
from OpenSSL import SSL
File "/Users/carterdavis/anaconda/lib/python2.7/site-packages/OpenSSL/__init__.py", line 36, in <module>
from OpenSSL import crypto
ImportError: dlopen(/Users/carterdavis/anaconda/lib/python2.7/site-packages/OpenSSL/crypto.so, 10): Library not loaded: libssl.1.0.0.dylib
Referenced from: /Users/carterdavis/anaconda/lib/python2.7/site-packages/OpenSSL/crypto.so
Reason: image not found
我有Python 2.7以及运行scrapy所需的每个包。
答案 0 :(得分:4)
看起来你正在使用Anaconda - 我遇到了同样的问题并修复了它(在OS X 10.9和10.10上测试过)。
如果安装了scip,请先卸载它。
使用conda安装加密:
conda install cryptography
设置DYLD_LIBRARY_PATH环境变量:
export DYLD_LIBRARY_PATH=$HOME/anaconda/lib
然后再次安装scrapy
pip install scrapy
答案 1 :(得分:0)
导入错误: dlopen(/Users/carterdavis/anaconda/lib/python2.7/site-packages/OpenSSL/crypto.so,10):未加载库: libssl.1.0.0.dylib
根据上面的错误消息,您的操作系统中是否安装了 libssl 包?如果您使用的是Ubuntu(或Debian),请尝试执行命令:
apt-get install libssl1.0.0
答案 2 :(得分:0)
这是加密安装的问题,请尝试再次安装crytography,其中还包括安装OpenSSL。你的项目将开始使用它。请按照以下步骤操作。
对于Debian和Ubuntu
$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
对于Fedora和RHEL衍生物
$ sudo yum install gcc libffi-devel python-devel openssl-devel
安装后, 您现在应该能够使用通常的
构建和安装加密$ pip install cryptography
在此之后,尝试创建您的scrapy项目。