【问题标题】:I'm trying to use pip to install pyinstaller but it's giving me this error: ImportError: No module named 'bz2'我正在尝试使用 pip 安装 pyinstaller,但它给了我这个错误: ImportError: No module named 'bz2'
【发布时间】:2017-03-24 22:15:38
【问题描述】:

我重新安装了我拥有的所有 python 版本(2.7、3.4 和 3.6)并且我不再收到“编码”错误,但另一个问题出现了。

我正在尝试安装 pyinstaller,我运行 pip install pyinstaller 但它给了我:

You are using pip version 6.0.8, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pyinstaller
  Using cached PyInstaller-3.2.1.tar.bz2
  Exception:
  Traceback (most recent call last):
    File "/usr/local/lib/python3.4/tarfile.py", line 1641, in bz2open
      import bz2
  ImportError: No module named 'bz2'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/local/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
      status = self.run(options, args)
    File "/usr/local/lib/python3.4/site-packages/pip/commands/install.py", line 339, in run
      requirement_set.prepare_files(finder)
    File "/usr/local/lib/python3.4/site-packages/pip/req/req_set.py", line 355, in prepare_files
      do_download, session=self.session,
    File "/usr/local/lib/python3.4/site-packages/pip/download.py", line 782, in unpack_url
      session,
    File "/usr/local/lib/python3.4/site-packages/pip/download.py", line 671, in unpack_http_url
      unpack_file(from_path, location, content_type, link)
    File "/usr/local/lib/python3.4/site-packages/pip/utils/__init__.py", line 654, in unpack_file
      untar_file(filename, location)
    File "/usr/local/lib/python3.4/site-packages/pip/utils/__init__.py", line 583, in untar_file
      tar = tarfile.open(filename, mode)
    File "/usr/local/lib/python3.4/tarfile.py", line 1566, in open
      return func(name, filemode, fileobj, **kwargs)
    File "/usr/local/lib/python3.4/tarfile.py", line 1643, in bz2open
      raise CompressionError("bz2 module is not available")
  tarfile.CompressionError: bz2 module is not available

【问题讨论】:

  • 您能否提供更多详细信息?您究竟是如何使用pip 的?你能发布完整的错误跟踪吗?
  • 我正在尝试安装 pyinstaller。我解决了另一个问题,但它仍然无法正常工作,现在的错误是:importError: No module named 'bz2'。 @juanpa.arrivillaga

标签: python pip pyinstaller importerror


【解决方案1】:

打开python的目录并确保那里的脚本文件夹 enter image description here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-04-21
    • 2012-09-14
    • 2015-04-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-14
    • 2017-05-18
    相关资源
    最近更新 更多