File: upgrade_pip_py310.py

package info (click to toggle)
gensim 4.2.0%2Bdfsg-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,396 kB
  • sloc: python: 26,427; sh: 108; cpp: 37; ansic: 26; makefile: 12
file content (10 lines) | stat: -rw-r--r-- 495 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
# This script needs to be able run under both Python 2 and 3 without crashing
# It only achieves the desired effect under Py3.10 on Linux and MacOS.
import subprocess
import sys
import tempfile
if sys.platform in ('linux', 'darwin') and sys.version_info[:2] == (3, 10):
    import urllib.request
    with tempfile.NamedTemporaryFile(suffix='.py') as fout:
        urllib.request.urlretrieve("https://bootstrap.pypa.io/get-pip.py", fout.name)
        subprocess.call([sys.executable, fout.name])