Asse田与python3和的virtualenv(assertionerror with pyth

2019-08-31 13:09发布

在Ubuntu清醒,我已经python2.6通过default.I想安装python 3.3.1

我从提取Python-3.3.1.tar.bz2到我的主文件夹sothat /home/me/Python-3.3.1包含所有files.Then按照自述我做

./configure
make
make test
sudo make install

这创造了一个可执行名为python/home/me/Python-3.3.1文件夹中。

此外,nowI有几个python3*中的文件/usr/local/bin目录。

其中 ,

python3是可执行文件的链接,

python3.3是一个可执行的,

python3.3m是一个可执行的。

我想创建一个python3和virtualenv中尝试以下

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

这产生一个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 ? 并再次运行安装?

Answer 1:

你已经安装了它。 只需指向安装python3。 试试这个:

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


文章来源: assertionerror with python3 and virtualenv