Skip to content

Instantly share code, notes, and snippets.

@jstrosch
Last active October 19, 2023 10:56
Show Gist options
  • Save jstrosch/de20131dda2aac5cd1116dd44b8f2474 to your computer and use it in GitHub Desktop.
Save jstrosch/de20131dda2aac5cd1116dd44b8f2474 to your computer and use it in GitHub Desktop.
This script will setup Python virtualenv, I made it specifically for setting up Cuckoo. Please see the notes in the script before running.
#!/usr/bin/env bash
# Author: Josh Stroschein
# Source: https://askubuntu.com/questions/244641/how-to-set-up-and-use-a-virtual-python-environment-in-ubuntu
# NOTES: Run this script as: sudo -u <USERNAME> cuckoo-setup-virtualenv.sh
# Additionally, your environment may not allow the script to source bashrc and you may need to do this manually after the script completes
# install virtualenv
sudo apt-get update && sudo apt-get -y install virtualenv
# install virtualenvwrapper
sudo apt-get -y install virtualenvwrapper
echo "source /usr/share/virtualenvwrapper/virtualenvwrapper.sh" >> ~/.bashrc
# install pip for python3
sudo apt-get -y install python3-pip
# turn on bash auto-complete for pip
pip3 completion --bash >> ~/.bashrc
# avoid installing with root
pip3 install --user virtualenvwrapper
echo "export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3" >> ~/.bashrc
echo "source ~/.local/bin/virtualenvwrapper.sh" >> ~/.bashrc
export WORKON_HOME=~/.virtualenvs
echo "export WORKON_HOME=~/.virtualenvs" >> ~/.bashrc
echo "export PIP_VIRTUALENV_BASE=~/.virtualenvs" >> ~/.bashrc
source ~/.bashrc
@zainkhan89
Copy link

Screenshot from 2021-06-16 19-50-52

Everything was going fine in all steps of your tutorial, until i faced this. How to go through this.

@jstrosch
Copy link
Author

I can't say for sure but looks like there may be two issues - first, you have a typo in the last octet of your IP address, ".1011". I'd try removing that. The second is that there is an error stating that the Vm already exists so I would try either removing it and starting over or using different information to set it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment