How to configure a package in PyPI to install only with pip3
Question: I distributed my package written in Python 3 on PyPI. It can be installed by
both `pip2` and `pip3`. How can I configure the package to only be available
in Python 3; i.e. to install only with `pip3`?

I've already added these classifiers in `setup.py` file:

    
    
    classifiers=[
        ...
        # Supported Python versions.
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        ...
    ]
    

But it still can be installed by `pip2`.


Answer: I'm not sure if such an option exists. What you could do though is manually
enforce it by checking that the version of python in which it is installed is
larger than the version you want to dictate:

    
    
    from sys import version_info
    
    class NotSupportedException(BaseException): pass
    
    if version_info.major < 3:
        raise NotSupportedException("Only Python 3.x Supported")  
    

While this won't stop it being reached from `pip2` it should stump any users
trying to use an old version of Python

