小编Lui*_* U.的帖子

"OSError 10.11(El Capitan)中安装Scrapy时出现"OSError:[Errno 1]操作不允许"(系统完整性保护)

我正在尝试通过pip在OSX 10.11(El Capitan)中安装Scrapy Python框架.安装脚本会下载所需的模块,并在某些时候返回以下错误:

OSError: [Errno 1] Operation not permitted: '/tmp/pip-nIfswi-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
Run Code Online (Sandbox Code Playgroud)

我尝试使用以下命令停用OSX 10.11中的无根功能:

sudo nvram boot-args="rootless=0";sudo reboot
Run Code Online (Sandbox Code Playgroud)

但是当机器重新启动时我仍然会遇到同样的错误.

来自我的StackExchangers同事的任何线索或想法?

如果有帮助,则完整脚本输出如下:

sudo -s pip install scrapy
Collecting scrapy
  Downloading Scrapy-1.0.2-py2-none-any.whl (290kB)
    100% |????????????????????????????????| 290kB 345kB/s 
Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): queuelib in /Library/Python/2.7/site-packages (from scrapy)
Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scrapy)
Collecting w3lib>=1.8.0 (from scrapy)
  Downloading w3lib-1.12.0-py2.py3-none-any.whl
Collecting lxml (from scrapy) …
Run Code Online (Sandbox Code Playgroud)

python macos scrapy python-2.7

205
推荐指数
11
解决办法
20万
查看次数

如何知道列表中的哪个元素触发了any()函数?

我正在开发一个Python程序来检测记录列表中的城市名称.我到目前为止开发的代码如下:

aCities = ['MELBOURNE', 'SYDNEY', 'PERTH', 'DUBAI', 'LONDON']

cxTrx = db.cursor()
cxTrx.execute( 'SELECT desc FROM AccountingRecords' )

for row in cxTrx.fetchall() :
    if any( city in row[0] for city in aCities ) :
        #print the name of the city that fired the any() function
    else :
        # no city name found in the accounting record
Run Code Online (Sandbox Code Playgroud)

该代码可以很好地检测在会计记录中找到aCities列表中的城市,但是当any()函数返回True或False时我很难知道哪个城市(墨尔本,悉尼,珀斯,迪拜或伦敦) )触发退出.

我已经尝试过aCities.index和队列但到目前为止没有成功.

python python-2.7

7
推荐指数
1
解决办法
256
查看次数

标签 统计

python ×2

python-2.7 ×2

macos ×1

scrapy ×1