虚拟Python2.7

2024-10-01 15:34:49 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经在我的Ubuntu10LTS上安装了Python2.7

tar xzf Python-2.7.tgz
cd Python-2.7
./configure
make
sudo make altinstall

python似乎安装正确。在

我安装了virtualenv。在

如果我使用以下方法创建环境,则一切正常:

^{pr2}$

但如果我尝试使用:

sudo virtualenv env --p python2.7 --no-site-packages

我有以下错误:

ImportError: No module named warnings
ERROR: The executable env1/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is '/home/me/Documents/test1' (should be '/home/me/Documents/test1/env')
ERROR: virtualenv is not compatible with this system or executable

在另一台机器上,Python2.7运行正常,所以我猜Python2.7安装或virtualenv安装有问题,但我不知道如何开始查找问题隐藏在哪里


Tags: envhomemakevirtualenvissudonoterror
2条回答

我安装了一个全新的系统ubuntu10.04 LTS 我安装了python

sudo添加apt存储库ppa:fkrull/死蛇 更新源 sudo apt get安装python2.7

我安装了virtualenv sudo apt get安装python virtualenv

命令 sudo virtualenv-pPython2.7

失败并返回:

ImportError:没有名为warnings的模块 错误:可执行文件env/bin/python2.7无法运行 错误:它认为系统前缀是'/home/me/Documents/code/jord'(应该是'/home/me/Documents/code/jord/env')

更新

我编辑了虚拟人.py并在所需的模块列表中添加了“warnings”和“uweakrefset”,它现在似乎可以工作了

你为什么要自己编译python?它是ubuntu,所以我会用apt-get安装setuptools、virtualenv和virtualenvwrapper。然后按照http://www.doughellmann.com/docs/virtualenvwrapper/正确设置virtualenvwrapper。python2.7将自动包含在您构建的任何VE中。在

相关问题 更多 >

    热门问题