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

<p>I've already added these classifiers in <code>setup.py</code> file:</p>

<pre class="lang-py prettyprint-override"><code>classifiers=[
    ...
    # Supported Python versions.
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.4',
    'Programming Language :: Python :: 3.5',
    ...
]
</code></pre>

<p>But it still can be installed by <code>pip2</code>.</p>

<p>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:</p>

<pre><code>from sys import version_info

class NotSupportedException(BaseException): pass

if version_info.major &lt; 3:
    raise NotSupportedException("Only Python 3.x Supported")  
</code></pre>

<p>While this won't stop it being reached from <code>pip2</code> it should stump any users trying to use an old version of Python  </p>

python python-3.x pypi