2017-08-04 31 views
1

我是virtualenv的新手,並試圖使其工作,以便與給定的項目一起工作。我遵循this指南將其設置完畢。只要我進入virtualenv,pip就會停止處理提到的錯誤。這裏Virtualenv pip ssl - 嘗試安裝任何軟件包時失敗。錯誤:「Python中的ssl模塊不可用」

確切的問題是這樣的:

(virtual-env) $ pip install --trusted-host pypi.python.org Django==1.11.4 
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. 
Collecting Django==1.11.4 
    Could not fetch URL https://pypi.python.org/simple/django/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping 
    Could not find a version that satisfies the requirement Django==1.11.4 (from versions:) 
No matching distribution found for Django==1.11.4 

...是... --trusted-host沒有什麼區別...看來,因爲它需要一些包,我找不到。

版本:

  • 的Python

    $ python --version 
    Python 3.6.2 
    
  • 皮普

    $ pip --version # <- Edited 
    pip 9.0.1 
    

我也嘗試安裝SSL模塊,但無濟於事。原來你不能用python 3安裝ssl。問題是print sintax。

[...] 
    File "/tmp/pip-build-undfmh27/ssl/setup.py", line 33 
    print 'looking for', f 
        ^
SyntaxError: Missing parentheses in call to 'print' 

任何幫助表示讚賞

+1

幾個筆記。您向我們展示'pip3 --version',但運行'pip install'; 'pip'(而不是'pip3')應該是Python 2.7。關於'print'中缺少括號的錯誤是Py2與Py3:在python 3中'print'是print()函數。 PyPI中的模塊'ssl'是[Py2 only](https://github.com/pypa/ssl/issues/7);對於Py3,你不需要安裝任何東西 - 所有東西都已經在Python中。 – phd

+0

你幾乎是正確的。事情是,在virtualenv內,pip不過是與pip3的象徵性鏈接。我編輯了這個問題來澄清。謝謝! – coya

回答

1

嗯......原來,療法一定的順序與Python 3.6安裝的東西。這post是非常有幫助的。

正在關注this指示我能夠按照我的預期讓我的virtualenv工作。

總結。 之前安裝Python 3.6.2中的問題,你需要如下準備環境:

$ sudo apt-get install build-essential checkinstall 
$ sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev 

也只有這樣,安裝python 3和的virtualenv中使用它。

相關問題