问题
In ubuntu lucid,I have python2.6
by default.I wanted to install 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
This created an executable named python
in /home/me/Python-3.3.1
folder.
Also, nowI have several python3*
files in the /usr/local/bin
directory.
Among them ,
python3 is a link to executable,
python3.3 is an executable,
python3.3m is an executable.
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
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']
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?
回答1:
You've already installed it. Just point to the installed python3. try this:
virtualenv envpy331 --python=/usr/local/bin/python3.3
来源:https://stackoverflow.com/questions/16098830/assertionerror-with-python3-and-virtualenv