Jan-20-2019, 06:09 PM
I have a whole bunch of old projects that were created without virtual environment.
many of them use the same packages, so I thought I'd create a bash script to:
Everything works until I get to step 5 (deactivate) The command executes, but when the script exits, the virtual environment is still running
My bash shell programming skills are very rusty, so what am I doing wrong?
script:
many of them use the same packages, so I thought I'd create a bash script to:
- Create a virtual environment
- Activate the environment
- Create a requirements.txt file for the packages
- Run pip to install the packages
- deactivate the virtual environment
- Move to next project and do it all again
Everything works until I get to step 5 (deactivate) The command executes, but when the script exits, the virtual environment is still running
My bash shell programming skills are very rusty, so what am I doing wrong?
script:
#!/bin/bash python -m venv venv . ./venv/bin/activate cat > ./venv/requirements.txt << EOM lxml requests pylint BeautifulSoup4 selenium EOM pip install -r ./venv/requirements.txt cp -r ../../../A-D/D/drivers/chromedriver ./venv/bin/chromedriver cp -r ../../../A-D/D/drivers/geckodriver ./venv/bin/geckodriver . deactivate