python3和virtualenv的assertionerror [英] assertionerror with python3 and virtualenv

查看:130
本文介绍了python3和virtualenv的assertionerror的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ubuntu lucid中,我默认为python2.6.我想安装python 3.3.1.

In ubuntu lucid,I have python2.6 by default.I wanted to install python 3.3.1.

我从Python-3.3.1.tar.bz2提取到我的主文件夹中,以便/home/me/Python-3.3.1包含所有文件.然后按照我做的自述文件

I extracted from Python-3.3.1.tar.bz2 into my home folder sothat /home/me/Python-3.3.1 contains all the files.Then as per the Readme I did

./configure
make
make test
sudo make install

这在/home/me/Python-3.3.1文件夹中创建了一个名为python的可执行文件.

This created an executable named python in /home/me/Python-3.3.1 folder.

此外,现在我在/usr/local/bin目录中有几个python3*文件.

Also, nowI have several python3* files in the /usr/local/bin directory.

其中

python3是可执行文件的链接,

python3 is a link to executable,

python3.3是可执行文件,

python3.3 is an executable,

python3.3m是可执行文件.

python3.3m is an executable.

我想为python3创建一个virtualenv并尝试以下

I wanted to create a virtualenv for python3 and tried the following

sudo virtualenv envpy331 --distribute --no-site-packages --python=/home/me/Python-3.3.1/python

这产生了AssertionError

This produced an AssertionError

File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 2471, in <module>
    main()
  File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 942, in main
    never_download=options.never_download)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 1043, in create_environment
    site_packages=site_packages, clear=clear))
  File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 1207, in install_python
    copy_required_modules(home_dir)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 1159, in copy_required_modules
    dst_filename = change_prefix(filename, dst_prefix)
  File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.8.2-py2.6.egg/virtualenv.py", line 1134, in change_prefix
    (filename, prefixes)
AssertionError: Filename /home/me/Python-3.3.1/Lib/os.py does not start with any of these prefixes: ['/usr/local']

我需要纠正什么?我需要删除python3安装,还是需要用prefix=/usr/local重新配置它?并再次运行安装?

what do I need to correct this? do I need to remove the python3 installation ,or do I need to reconfigure it with prefix=/usr/local ? and again run the install?

推荐答案

您已经安装了它.只需指向已安装的python3. 试试这个:

You've already installed it. Just point to the installed python3. try this:

virtualenv envpy331 --python=/usr/local/bin/python3.3

这篇关于python3和virtualenv的assertionerror的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆