Skip to content

Instantly share code, notes, and snippets.

@SMillerDev
Created July 2, 2018 18:03
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SMillerDev/f4cfa15dc2fe4bbc56938a6b997a5d1b to your computer and use it in GitHub Desktop.
Save SMillerDev/f4cfa15dc2fe4bbc56938a6b997a5d1b to your computer and use it in GitHub Desktop.
Script to port pip installs
#!/bin/bash
folder=$1
files="${folder}*.dist-info"
regex="\/([a-zA-Z_\.0-9]*)-([0-9\.]*)\.dist-info"
for f in $files
do
if [[ $f =~ $regex ]]
then
name="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "${name}==${version}" # concatenate strings
else
echo "$f doesn't match" >&2 # this could get noisy if there are a lot of non-mat$
fi
done
@resistor4u
Copy link

There are several modules that aren't ready for the jump to python 3.7, like PyYAML, PyProj, matplotlib. So, your script might transfer the modules, but they probably won't work if called.

What I did was:

brew unlink python3
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
pip3 freeze > pip3list.txt
brew uninstall --ignore-dependencies python3
brew cleanup -s --force
brew prune
brew link python3
python3 -m pip install -r pip3list.txt

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