简体   繁体   中英

How to install virtualenv in oracle RHEL VM

I found many similar questions but nothing could help. This is what I have done till now. I am using RHEL6.0 server on my Oracle VM. There I tried to install Django 1.8. It failed during installation as server has default python2.6 version. I manually installed python2.7.3 by following below commands.

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar -zxvf Python-2.7.3.tar.gz
cd Python-2.7.3
./configure --prefix=/home/localpath
make
make install

Then I tried to install virtualenv using below commands.

wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.5.2.tar.gz
cd virtualenv-1.5.2/

/home/localpath/bin/python setup.py install
/home/localpath/bin/virtualenv --no-site-packages /home/anypath/virtual_world

but it failed with the LookupError: unknown encoding: zlib. error. I installed zlib using sudo yum install zlib-devel and then installed python2.7.3 once again. But now same command is failing with this error.

--always-copy -U setuptools failed with error code 1

please help me install this virtualenv with custom python2.7.3 .I have already put 2 days in effort :(. Thanks.

Addition- Now I have installed virtualenv14.05 as the earlier one was far older. but it failed with the new error.

   OSError: Command /home/.../bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel failed with error code 1

Please help.

I finally get my misery period over. I did the below. I installed virtualenv with my default puthon2.6 interpreter.

sudo easy_install virtualenv==1.10.1 

Then I created a virtualenv using my custom python.

virtualenv --no-site-package --python /home/localpath/bin/python virtual_world

Now I can see python2.7.3 in my bin directory within virtual folder. but then when I tried to install django using pip ot easy_install It gave me below error.

ImportError: cannot import name HTTPSHandler

So I first run the below command to install openssl & then reinstalled my custom python 2.7.3

sudo yum install openssl openssl-devel -y

I was able to install Django but when I ran python manage.py runserver I got the below error.

 Error loading either pysqlite2 or sqlite3 modules

I ran the below command & reinstall python once again.

sudo yum install sqlite-devel

While reinstalling python I ran ./configure like this

./configure --enable-loadable-sqlite-extensions --prefix=/home/localpath/

After all this now I can successfully install virtualenv & django 1.8 on my virtual box. Thanks all

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