Issue
I needed to rename a python venv virtual environment in macOS 12.1
I followed the instructions in href="https://stackoverflow.com/a/68400551">https://stackoverflow.com/a/68400551
I have already done
mv old_venv new_venv
Then
cd /path/to/new_venv/bin
Then
sed -i 's/old_venv/new_venv/g' *
I get the following error sed: 1: "Activate.ps1": invalid command code A
I tried this
sed -i'.original' 's/old_venv/greendeploy-py3101/g' *
after reading https://stackoverflow.com/a/4247319/80353
Then I get sed: python: in-place editing only works for regular files
What is another way to rename venv in macOS 12.1?
I know i can delete and then do a new venv from scratch but i would like to rename where possible.
Solution
Ok I solved it
I just realized from the 2nd link i provided in the question there's an alternative to using perl
From https://stackoverflow.com/a/4247319/80353, last line
perl -i -pe's/old_venv/new_venv/g' *
So the whole solution is
At the folder level
mv old_venv new_venv
(no change)
Then
cd /path/to/new_venv/bin
(no change)
Then
perl -i -pe's/old_venv/new_venv/g' *
(use this instead of sed)
Answered By - Kim Stacks Answer Checked By - Marilyn (WPSolving Volunteer)