2017-02-14 77 views
3

我用在CentOS 7最新的Python和專用的virtualenv我怎麼才能安裝上Python3.6扭曲+ Scrapy和CentOS

(ENV) [[email protected] ~ ]$ lsb_release -a 
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch 
Distributor ID: CentOS 
Description: CentOS Linux release 7.3.1611 (Core) 
Release: 7.3.1611 
Codename: Core 

(ENV) [[email protected] ~ ]$ python --version 
Python 3.6.0 

當我安裝scrapy,錯誤

(ENV) [[email protected] ~ ]$ pip install scrapy 
Collecting scrapy 
    Using cached Scrapy-1.3.2-py2.py3-none-any.whl 
Collecting cssselect>=0.9 (from scrapy) 
    Using cached cssselect-1.0.1-py2.py3-none-any.whl 
Requirement already satisfied: six>=1.5.2 in ./ENV/lib/python3.6/site-packages (from scrapy) 
Collecting Twisted>=13.1.0 (from scrapy) 
    Could not find a version that satisfies the requirement Twisted>=13.1.0 (from scrapy) (from versions:) 
No matching distribution found for Twisted>=13.1.0 (from scrapy) 

當我安裝扭曲的獨立性時,錯誤

(ENV) [[email protected] ~ ]$ pip install Twisted 
Collecting Twisted 
    Could not find a version that satisfies the requirement Twisted (from versions:) 
No matching distribution found for Twisted 

(ENV) [[email protected] ~ ]$ pip install --verbose Twisted 
Collecting Twisted 
    1 location(s) to search for versions of Twisted: 
    * https://pypi.python.org/simple/twisted/ 
    Getting page https://pypi.python.org/simple/twisted/ 
    Looking up "https://pypi.python.org/simple/twisted/" in the cache 
    Current age based on date: 40208 
    Freshness lifetime from max-age: 600 
    Freshness lifetime from request max-age: 600 
    The cached response is "stale" with no etag, purging 
    Starting new HTTPS connection (1): pypi.python.org 
    "GET /simple/twisted/ HTTP/1.1" 200 10196 
    Updating cache with response from "https://pypi.python.org/simple/twisted/" 
    Caching b/c date exists and max-age > 0 
    Analyzing links from page https://pypi.python.org/simple/twisted/ 
Skipping link ... 
Could not find a version that satisfies the requirement Twisted (from versions:) 
Cleaning up... 
No matching distribution found for Twisted 
Exception information: 
Traceback (most recent call last): 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/commands/install.py", line 335, in run 
    wb.build(autobuilding=True) 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/wheel.py", line 749, in build 
    self.requirement_set.prepare_files(self.finder) 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files 
    ignore_dependencies=self.ignore_dependencies)) 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/req/req_set.py", line 554, in _prepare_file 
    require_hashes 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/req/req_install.py", line 278, in populate_link 
    self.link = finder.find_requirement(self, upgrade) 
    File "/home/luoc/ENV/lib/python3.6/site-packages/pip/index.py", line 514, in find_requirement 
    'No matching distribution found for %s' % req 
pip.exceptions.DistributionNotFound: No matching distribution found for Twisted 

那麼爲什麼不能在Python3.6上安裝Twisted?做錯了事我的環境?

Kmike suggested me to ask twisted's developer

+0

添加'--verbose --verbose --verbose'到你的'pip install Twisted'命令並在你的問題中包含輸出。 –

+0

@ Jean-PaulCalderone我在我的問題中添加了「--verbose」 – driftluo

+0

您添加的「--verbose」越多,它轉儲的信息就越多。 –

回答

4

你自己編譯的Python 3.6?

看來你的python版本是在沒有bzip2支持的情況下編譯的。這是同一問題的過去票證:https://twistedmatrix.com/trac/ticket/8177

我建議使用Miniconda有一個Python 3.6環境,並按照this instructions來安裝Scrapy。

+0

很抱歉,我很晚很感謝你。我自己編譯Python3.6,我會嘗試下載bzip2-dev,然後重新編譯Python3.6,再次感謝 – driftluo

3

我知道問題已經解決,但我想幫助未來的用戶。
我在Debian STRECH,只是安裝了Python 3.6,
如果你想安裝scrapy編譯的Python 3.6自己,嘗試運行

sudo apt-get install bzip2 libbz2-dev 

之後,只需重新編譯的Python 3.6,它應該工作

+0

使用'pyenv install 3.6.1'時遇到同樣的問題安裝這些庫並重新安裝後發佈上述命令,它可以工作。 –