2016-05-23 172 views
1

我想在Ubuntu 15.10上使用python3創建venv。 我已經安裝了python 3.4.4。 首先,我試圖通過PIP3安裝VENV(我已經通過python2.7安裝了它,但據我瞭解,爲PY3我應該重新安裝)安裝venv for python3

pip3 install virtualenv 

而且我得到了The 'pip==8.0.0' distribution was not found and is required by the application錯誤。

下一個我試圖用這個命令安裝PIP 3:

> sudo apt-get install python3-pip 

,看起來像它已成功完成。但是,當我運行

> pip3 

我收到以下錯誤:

Traceback (most recent call last): 
    File "/usr/local/bin/pip3", line 5, in <module> 
    from pkg_resources import load_entry_point 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3130, in <module> 
    @_call_aside 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3116, in _call_aside 
    f(*args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3143, in _initialize_master_working_set 
    working_set = WorkingSet._build_master() 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 644, in _build_master 
    return cls._build_from_requirements(__requires__) 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 657, in _build_from_requirements 
    dists = ws.resolve(reqs, Environment()) 
    File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 830, in resolve 
    raise DistributionNotFound(req, requirers) 
pkg_resources.DistributionNotFound: The 'pip==8.0.0' distribution was not found and is required by the application 

如果我運行

> pip --version 
pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7) 

難道我做錯了什麼? pip3只需要pip == 8.0嗎?

回答

1

畫中畫指向到Python 2.7

usr/local/lib/python2.7/ 

第一個變化路徑

export PATH=/path/to/python3:/path/to/python3/scripts-folder:/path/to/python3-pip:$PATH 

支票路徑

echo $PATH 

然後運行PIP或PIP 3

+0

謝謝!我用另一種方式解決了它:只運行virtualenv -p /usr/bin/python3.4 .venv3,我得到了我所需要的。 :) – Paul