2017-11-17 214 views
1

我正在嘗試安裝spacy。我在CentOS Linux上點擊ctrl-c在安裝spacy時,現在在嘗試再次安裝時出現錯誤

!pip install -U spacy 

在jupyter筆記本和一切工作正常。在安裝過程中,我意識到我打算包含--user命令,因爲我只打算爲我的用戶安裝,所以我點擊了ctrl-c。此時安裝不完整。

嘗試用pip再次安裝軟件包現在給我一個錯誤,無論我是否包含--user標誌。我認爲下面的錯誤與不完整的構建有關。有誰知道如何解決這一問題?

Collecting spacy 
Exception: 
Traceback (most recent call last): 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/basecommand.py", line 
215, in main 
status = self.run(options, args) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/commands/install.py", 
line 335, in run 
wb.build(autobuilding=True) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/wheel.py", line 749, in 
build 
self.requirement_set.prepare_files(self.finder) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/req/req_set.py", line 
380, in prepare_files 
ignore_dependencies=self.ignore_dependencies)) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/req/req_set.py", line 
620, in _prepare_file 
session=self.session, hashes=hashes) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/download.py", line 809, 
in unpack_url 
unpack_file_url(link, location, download_dir, hashes=hashes) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/download.py", line 715, 
in unpack_file_url 
unpack_file(from_path, location, content_type, link) 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/utils/__init__.py", 
line 599, in unpack_file 
flatten=not filename.endswith('.whl') 
File "/opt/anaconda2/lib/python2.7/site-packages/pip/utils/__init__.py", 
line 484, in unzip_file 
zip = zipfile.ZipFile(zipfp, allowZip64=True) 
File "/opt/anaconda2/lib/python2.7/zipfile.py", line 770, in __init__ 
self._RealGetContents() 
File "/opt/anaconda2/lib/python2.7/zipfile.py", line 811, in _ 
RealGetContents 
raise BadZipfile, "File is not a zip file" 
BadZipfile: File is not a zip file` 
+0

當您執行作業或ps aux |時,您是否看到任何相關進程或作業? grep pip'? – JacobIRR

+0

您也可以嘗試通過設置'--no-cache-dir'標誌來禁用pip緩存。 –

+0

車輪文件可能已損壞或不完整。試試'pip install --upgrade --force-reinstall spacy' –

回答

0

謝謝大家。爲我工作的解決方案是轉到$ HOME/.cache/pip並刪除http /和wheels的內容/