【问题标题】:error installing distribute_setup.py from virtual environment on linux从 Linux 上的虚拟环境安装distribute_setup.py 时出错
【发布时间】:2013-04-19 01:44:35
【问题描述】:

我已经尝试了几个小时来让 Distribute_setup.py 在活动的虚拟环境中正确安装。我让它运行,但我总是得到一个错误。任何帮助,将不胜感激。我目前正在尝试在 Ubuntu 12.10 中执行此操作。

谢谢!

 python distribute_setup.py
 Extracting in /tmp/tmpvmrkpz
 Traceback (most recent call last):
 File "distribute_setup.py", line 546, in <module>
 sys.exit(main())
 File "distribute_setup.py", line 543, in main
 return _install(tarball, _build_install_args(options))
 File "distribute_setup.py", line 76, in _install
 tar = tarfile.open(tarball)
 File "/usr/local/lib/python3.3/tarfile.py", line 1571, in open
 raise ReadError("file could not be opened successfully")
 tarfile.ReadError: file could not be opened successfully
 (DjangoTutorial) test@ubuntu:~$ 

(DjangoTutorial) 是活动的虚拟环境

这是我尝试构建依赖项时得到的结果

test@ubuntu:~/Code/Tutorial$ sudo apt-get build-dep python3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: You must put some 'source' URIs in your sources.list
test@ubuntu:~/Code/Tutorial$ 

Python3.3安装在/usr/local/lib中

我也试过重装ubuntu和python3.3还是不行!

【问题讨论】:

  • 您使用的是什么 Linux 发行版?大多数提供预制包。
  • 我使用的是 ubuntu 12.10
  • 您有足够的磁盘空间来下载 tar 文件吗?还是解压到tmp?

标签: python linux python-3.x distribute


【解决方案1】:

这似乎不是虚拟环境问题。而是缺少 python 安装的依赖项的问题。试试

sudo apt-get build-dep python3

然后尝试再次配置和构建python3.3。还要添加 -dev 包

sudo apt-get install python3.3-dev

现在尝试安装您的软件包。您很可能想再次创建虚拟环境。

tarfile.py 尝试使用四种提取方法(tar、gzip、bz2、xopen)之一打开压缩包,如果在 python 库中找不到相应的模块,则会出错,其中一些可能不包含在基础 python 包。

【讨论】:

  • 不幸的是,这不起作用。我无法让 build-dep python3 成功运行。有什么想法吗?
  • 您能否将错误分享为您问题中的编辑。另外,请指出您的 python3.3 安装位置,以便在重新配置之前更容易将其删除。
  • 刚刚添加了更多细节。感谢您的帮助!
  • 如果您不介意再次安装 ubuntu,那么这个 (askubuntu.com/questions/244544/how-to-install-python-3-3) 是帮助您安装 python3.3 的好资源,其中还包括设置 venv 的说明。由于您想使用虚拟环境,因此您的 python 安装是否在 /opt/ 中并不重要。记得在安装 python3.3 之前构建依赖项。为此,您可以编辑文件/etc/apt/sources.list 并添加与launchpad.net/ubuntu/+archivemirrors 给出的位置对应的源(deb-src 行)
  • 好的,我得到它来安装构建依赖项,但现在它说我需要 zlib 来运行 distrib.py 的 setup.py
【解决方案2】:

distribute_setup.py 将尝试下载包(从网络)然后安装它。也许您的下载由于某种原因无法完成,这就是下一步(提取 tarball)失败的原因。

您可以尝试从here下载源码,然后手动安装。

  1. 解压下载的tar

    $ tar -xzvf distribute-0.6.36.tar.gz

  2. 切换到解压目录

    $ cd distribute-0.6.36

  3. 运行安装

    $ python setup.py install

【讨论】:

    猜你喜欢
    • 2020-07-17
    • 1970-01-01
    • 1970-01-01
    • 2019-05-16
    • 2018-02-18
    • 1970-01-01
    • 2018-12-28
    • 2017-02-26
    • 1970-01-01
    相关资源
    最近更新 更多