【问题标题】:Pycharm says "tarfile.ReadError: file could not be opened successfully"Pycharm 说“tarfile.ReadError:文件无法成功打开”
【发布时间】:2018-04-18 14:35:57
【问题描述】:

今天我尝试使用Python3.2 创建一个不使用 Pycharm 的新 python 项目。但我发现有些不对劲。

当我试图找到我的 python 解释器的路径时,我得到了那个:

Python 3.2 (r32, Apr 18 2018)
>>> import sys
>>> print(sys.executable)
/usr/local/bin/python3.2

所以我把这条路径放在填充部分Base解释器

Windows python interpreter Pycharm Project

但是当按下按钮创建项目时,出现这个错误:

Traceback (most recent call last):
  File "/home/David/pycharm-community-2018.1.1/helpers/packaging_tool.py", line 159, in main
    retcode = do_untar(name)
  File "/home/David/pycharm-community-2018.1.1/helpers/packaging_tool.py", line 100, in do_untar
    tar = tarfile.open(name)
  File "/usr/local/lib/python3.2/tarfile.py", line 1744, in open
    raise ReadError("file could not be opened successfully")
tarfile.ReadError: file could not be opened successfully

谁能告诉我怎么了?谢谢。

【问题讨论】:

  • 变量name引用的文件是什么?它是压缩的焦油吗?你的 Python 是否支持 zlib? The search for the error
  • 缩小了问题的范围,我已经在 usr/local/lib 的 ubuntu 中安装了 python 3.6.5,并且内置的 python 3.5 在 usr/bin 中,如果我使用 3.5 我没有错误,但是如果我使用 3.6.5 我得到了同样的错误
  • 我在 Ubuntu 中使用 Python 3.7 时遇到了同样的问题。有人解决了这个问题吗?
  • 我遇到了类似的问题。原来该文件是一个 html 页面(扩展名为 .xz),而不是实际的存档。

标签: python pycharm python-3.2 pythoninterpreter


【解决方案1】:

我遇到了完全相同的事情,并在这里找到了答案:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206601205-Can-t-Install-setuptools-from-within-PyCharm-on-Linux?page=1

您必须编译 zlib 并使用 zlib 头文件路径重新编译 python。

以下是编译 Python 的方法(不要忘记 -with-zlib 部分):

https://stackabuse.com/install-python-on-mac-osx/#installpythonfromsource

【讨论】:

    猜你喜欢
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    • 2011-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多