How can I specify a python version using setuptools?
Question: Is there a way to specify a python version to be used with a python package
defined in setup.py?

My setup.py currently looks like this:

    
    
    from distutils.core import setup
    setup(
      name = 'macroetym',
      packages = ['macroetym'], # this must be the same as the name above
      version = '0.1',
      description = 'A tool for macro-etymological textual analysis.',
      author = 'Jonathan Reeve',
      author_email = 'jon.reeve@gmail.com',
      url = 'https://github.com/JonathanReeve/macro-etym', 
    
      download_url = 'https://github.com/JonathanReeve/macro-etym/tarball/0.1', # FIXME: make a git tag and confirm that this link works
      install_requires = ['Click', 'nltk', 'pycountry', 'pandas',
                          'matplotlib'],
      include_package_data = True,
      package_data = {'macroetym': ['etymwm-smaller.tsv']}, 
      keywords = ['nlp', 'text-analysis', 'etymology'], 
      classifiers = [],
      entry_points='''
          [console_scripts]
          macroetym = macroetym.main:cli
      ''',
    )
    

It's a command-line program. My script runs using Python 3, but a lot of
operating systems still have Python 2 as the default. How can I specify a
python version to be used here? I can't seem to find anything in [the
docs](https://pythonhosted.org/setuptools/setuptools.html#declaring-
dependencies), but maybe I'm not looking in the right place?


Answer: You can't force the usage of a Python 3 interpreter but you can raise an error
or warning using `sys.version` or `platform.python_version()`

    
    
    import sys
    print(sys.version)
    print(sys.version_info)
    print(sys.version_info.major)  # Returns 3 for Python 3
    

Or:

    
    
    import platform
    print(platform.python_version())
    

