简体   繁体   English

在Linux上的虚拟环境中安装Distribution_setup.py时出错

[英]error installing distribute_setup.py from virtual environment on linux

I have been trying for a few hours to get distribute_setup.py to install correctly in an active virtual environment. 我已经尝试了几个小时,才能使distributed_setup.py正确安装在活动的虚拟环境中。 I get it to run, but I always get an error. 我可以运行它,但总是会出错。 Any help would be appreciated. 任何帮助,将不胜感激。 I am currently trying to do this in Ubuntu 12.10. 我目前正在Ubuntu 12.10中尝试这样做。

Thanks! 谢谢!

 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) is the active virtual environment (DjangoTutorial)是活动的虚拟环境

Here is what I get when I try to build the dependencies 这是我尝试构建依赖项时得到的信息

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 is installed in /usr/local/lib Python3.3安装在/ usr / local / lib中

I also tried reinstalling ubuntu and python3.3 and it still doesnt work! 我也尝试过重新安装ubuntu和python3.3,但仍然无法正常工作!

This doesnt seem like a virtual environment problem. 这似乎不是一个虚拟环境问题。 Rather a problem of missing dependencies for your python installation. 而是缺少您的python安装依赖项的问题。 Try 尝试

sudo apt-get build-dep python3

Then try to configure and build python3.3 again. 然后尝试再次配置和构建python3.3。 Also add the -dev package 同时添加-dev包

sudo apt-get install python3.3-dev

Now try installing your package. 现在尝试安装您的软件包。 Most likely you want to create your virtual environment again. 您很可能希望再次创建虚拟环境。

tarfile.py tries to open the tarball using one of the four extraction methods (tar, gzip, bz2, xopen) and it errors out if it cant find respective modules in the python library, some of which might not be included in the base python package. tarfile.py尝试使用四种解压缩方法之一(tar,gzip,bz2,xopen)打开tarball,如果无法在python库中找到相应的模块,则会出错,其中一些可能未包含在基本python中包。

distribute_setup.py will attempt to download the package (from the net) and then install it. distribute_setup.py将尝试(从网上)下载软件包,然后安装它。 Perhaps your download cannot complete for some reason and that is why the next step (Extracting the tarball) fails. 也许您的下载由于某种原因而无法完成,这就是为什么下一步(提取压缩包)失败的原因。

You can try to download the source from here and then install it manually. 您可以尝试从此处下载源,然后手动安装。

  1. Extract the downloaded tar 解压缩下载的tar

    $ tar -xzvf distribute-0.6.36.tar.gz

  2. Change to the extracted directory 转到提取的目录

    $ cd distribute-0.6.36

  3. Run install 运行安装

    $ python setup.py install

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM