0
0

Pythonのスクリプト内でバージョンを確認する方法

Last updated at Posted at 2024-06-25
check_version.py
import sys

v = sys.version_info
print(v)

if (v.major == 3 and v.minor >= 7) or (v.major >= 4):
	print('version 3.7 or more')

if (v.major == 3 and v.minor <= 7) or (v.major <= 2):
	print('version 3.7 or less')

# > python check_version.py
# sys.version_info(major=3, minor=12, micro=4, releaselevel='final', serial=0)
# version 3.7 or more
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0