简体   繁体   中英

VirtualEnv python2.7 error

I have installed Python 2.7 on my ubuntu 10 LTS

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

The python seems to be correctly installed.

I have installed virtualenv.

Everything works fine if I create an envrionment using:

sudo virtualenv env 

But if I try to use:

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

I have the follwing error:

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

On another machine, everything works fine with Python2.7 so I guess there something wrong with my python2.7 install or with my virtualenv install, but I have no idea how to start looking where the problem is hidden

I installed a brand new system ubuntu10.04 LTS I installed python

sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python2.7

I install virtualenv sudo apt-get install python-virtualenv

The command sudo virtualenv env -p python2.7

Fails and returns :

ImportError: No module named warnings ERROR: The executable env/bin/python2.7 is not functioning ERROR: It thinks sys.prefix is '/home/me/Documents/code/jord' (should be '/home/me/Documents/code/jord/env')

UPDATE

I edited the source of virtualenv.py and added 'warnings' and '_weakrefset' in the list of REQUIRED_MODULES and it seems to work now

Any reason why you want to compile python yourself? It is ubuntu so I would install setuptools, virtualenv and virtualenvwrapper using apt-get. Then follow http://www.doughellmann.com/docs/virtualenvwrapper/ to setup virtualenvwrapper properly. Python 2.7 will automatically be included for you in any VE you build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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