【问题标题】:Python3: install in virtualenv failsPython3:在 virtualenv 中安装失败
【发布时间】:2017-09-28 11:40:03
【问题描述】:

我尝试创建 Python3 virtualenv 并在其中测试一些 Python 代码:

python3 -m venv tbzuploader-py3env
cd tbzuploader-py3env
. ./bin/activate
pip install -e git+https://github.com/guettli/tbzuploader.git#egg=tbzuploader

这是我得到的输出:

Obtaining tbzuploader from git+https://github.com/guettli/tbzuploader.git#egg=tbzuploader
  Cloning https://github.com/guettli/tbzuploader.git to ./src/tbzuploader
Collecting requests (from tbzuploader)
  Using cached requests-2.18.4-py2.py3-none-any.whl
Collecting future (from tbzuploader)
  Using cached future-0.16.0.tar.gz
Collecting urllib3<1.23,>=1.21.1 (from requests->tbzuploader)
  Using cached urllib3-1.22-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests->tbzuploader)
  Using cached chardet-3.0.4-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests->tbzuploader)
  Using cached certifi-2017.7.27.1-py2.py3-none-any.whl
Collecting idna<2.7,>=2.5 (from requests->tbzuploader)
  Using cached idna-2.6-py2.py3-none-any.whl
Building wheels for collected packages: future
  Running setup.py bdist_wheel for future ... error
  Complete output from command /home/tguettler/projects/tbzuploader-py3env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4iiy_oby/future/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpukjvdwtmpip-wheel- --python-tag cp35:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for future
  Running setup.py clean for future
Failed to build future
Installing collected packages: urllib3, chardet, certifi, idna, requests, future, tbzuploader
  Running setup.py install for future ... done
  Running setup.py develop for tbzuploader
Successfully installed certifi-2017.7.27.1 chardet-3.0.4 future-0.16.0 idna-2.6 requests-2.18.4 tbzuploader urllib3-1.22
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

我使用 Ubuntu 16.04 中的 Python:

===> python --version
Python 3.5.2

我做错了什么?

【问题讨论】:

  • 默认venv安装pip版本8。你应该更新它:pip install --upgrade pip
  • @AK47 你必须删除sudo -H,因为你想在virtualenv而不是系统范围内更新setuptools
  • @AndMar 是的,“pip install --upgrade pip”解决了这个问题。如果您将评论写为答案,我会接受并投票。
  • 更常见的是,在创建新的 virtualenv 后发出此命令:pip install -U pip setuptools wheel

标签: python python-3.x pip virtualenv


【解决方案1】:

默认venv安装了pip版本8。你应该更新它:pip install --upgrade pip

【讨论】:

    【解决方案2】:

    您需要通过以下命令更新 pip 版本。

    pip install --upgrade pip

    当你安装 python3 时,pip3 被安装。如果您没有另一个 python 安装(如 python2.7),则会创建一个将 pip 指向 pip3 的链接。 pip 一般指向第一次安装。

    【讨论】:

      猜你喜欢
      • 2021-01-02
      • 2017-03-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-04
      • 2014-12-27
      • 2014-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多