Skip to content

Instantly share code, notes, and snippets.

@JeanElsner
Created June 8, 2023 09:37
Show Gist options
  • Save JeanElsner/15c5304e8f965f1326b5ce97c6e7949c to your computer and use it in GitHub Desktop.
Save JeanElsner/15c5304e8f965f1326b5ce97c6e7949c to your computer and use it in GitHub Desktop.
Single-line shell command to add extra-index-url to pip if it's not added already
extra_url=`pip config get global.extra-index-url 2>/dev/null`; url="<new-extra-url>"; if [[ ! $extra_url =~ $url ]]; then pip config set global.extra-index-url "$extra_url $url"; fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment