为python3安装venv

时间:2016-05-23 12:17:49

标签: python python-3.x pip

我试图在Ubuntu 15.10上使用python3创建venv。 我已经安装了python 3.4.4。 首先,我尝试通过pip3安装venv(我已经通过python2.7安装了它,但据我所知,对于py3我应该再次安装它)

- red green blue count
- 000 000   000  12
- 255 000   000  56
- 000 255   000  45
- 255 255   255  97

我发现pip3 install virtualenv 错误。

接下来我尝试使用以下命令安装pip3:

The 'pip==8.0.0' distribution was not found and is required by the application

看起来已成功完成。但是当我跑步时

> 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

我做错了吗? pip3只需要pip == 8.0吗?

1 个答案:

答案 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或pip3