Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I am working to set up a Django project on Amazon EC2 with an Ubuntu 14.04 LTS instance. I want to write my code using Python 3. I've been advised that the best way to do this is to use virtualenvwrapper. I've installed virtualenvwrapper successfully and put

export WORKON_HOME=$HOME/.virtualenvs

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.4

export PROJECT_HOME=$HOME/Devel

source /usr/local/bin/virtualenvwrapper.sh

into my .bashrc file. Now I see:

 /usr/bin/python3.4: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportErro

 r'>: No module named 'virtualenvwrapper')

 virtualenvwrapper.sh: There was a problem running the initialization hooks.     

 If Python could not import the module virtualenvwrapper.hook_loader,

 check that virtualenvwrapper has been installed for

 VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3.4 and that PATH is set properly.

How can I fix this?

1 Answer

0 votes
by (44.4k points)

Installing:

 ubuntu@ip-XXX-XX-XX-XX:~$ mkvirtualenv -p /usr/bin/python3.4  env1

 Running virtualenv with interpreter /usr/bin/python3.4

 Using base prefix '/usr'

 New python executable in env1/bin/python3.4

 Also creating executable in env1/bin/python

 Installing setuptools, pip...done.

Verifying and Running:

 (env1)ubuntu@ip-XXX-XX-XX-XX:~$ deactivate

 ubuntu@ip-XXX-XX-XX-XX:~$ ls

 ubuntu@ip-XXX-XX-XX-XX:~$ ls -a

 .  .. .bash_history  .bash_logout .bashrc  .cache .pip   .profile .ssh  .virtualenvs

 ubuntu@ip-XXX-XX-XX-XX:~$ workon

 env1

 ubuntu@ip-XXX-XX-XX-XX:~$ workon env1

 (env1)ubuntu@ip-XXX-XX-XX-XX:~$ which python

 /home/ubuntu/.virtualenvs/env1/bin/python

 (env1)ubuntu@ip-XXX-XX-XX-XX:~$  python -V

 Python 3.4.0

Related questions

0 votes
4 answers
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
asked Dec 8, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...