Python Forum
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code to run in python3
#6
Any message or documentation of what platform is needed Python 2 or 3,Windows,Linux,Mac?
Is a lot better that no info,which confuse people especially if new to Python.

There are build in stuff when make module/package,so can block it from install to wrong version.
If i copy out setup.py from my tutorial here.
# setup.py
from setuptools import setup
 
__author__ = 'snippsat'
 
setup(
   name="web_title",
   version='0.1',
   py_modules=['find_title'],
   description="Find web site title",
   url='https://python-forum.io/index.php',
   author_email='[email protected]',
   python_requires='>=3.4',
   classifiers=[
       'Programming Language :: Python :: 3.4',
       'Programming Language :: Python :: 3.5',
       'Programming Language :: Python :: 3.6',
    ],
   # These will be installed when pip wheel run
   install_requires=[
       'beautifulsoup4',
       'requests',
       'lxml',
   ],
)
So python_requires='>=3.4',will only install wheel to 3.4 or newer.
classifiers in more meta search data and info about platform,
do not set any restriction List trove classifiers - PyPI

So if try to install wheel made with this setup.py to Python 2 this happens.
# Try 2.7
C:\web\dist
λ py -2.7 -m pip install web_title-0.1-py3-none-any.whl
web_title-0.1-py3-none-any.whl is not a supported wheel on this platform.

# 3.6 and it work
C:\web\dist
λ pip install web_title-0.1-py3-none-any.whl
Processing c:\web\dist\web_title-0.1-py3-none-any.whl
Requirement already satisfied: beautifulsoup4 in c:\python36\lib\site-packages (from web-title==0.1)
Requirement already satisfied: requests in c:\python36\lib\site-packages (from web-title==0.1)
Requirement already satisfied: lxml in c:\python36\lib\site-packages (from web-title==0.1)
c:\python36\lib\site-packages (from requests->web-title==0.1)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python36\lib\site-packages (from requests->web-title==0.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests->web-title==0.1)
Installing collected packages: web-title
Successfully installed web-title-0.1

Quote:that has code which checks the version of python it is running under, and if running under a version less than what it needs, tries to re-run itself under the version it needs, 
pipenv has in fact now build stuff for this Automatic Python Installation.
Will not re run it self but ask if want to install version needed(work on Linux and Mac but also need that pyenv is configured).
Reply


Messages In This Thread
code to run in python3 - by Skaperen - Nov-05-2017, 01:30 AM
RE: code to run in python3 - by heiner55 - Nov-11-2017, 06:12 PM
RE: code to run in python3 - by Larz60+ - Nov-11-2017, 07:45 PM
RE: code to run in python3 - by Skaperen - Nov-12-2017, 04:23 AM
RE: code to run in python3 - by heiner55 - Nov-12-2017, 01:44 PM
RE: code to run in python3 - by Skaperen - Nov-13-2017, 02:44 AM
RE: code to run in python3 - by snippsat - Nov-12-2017, 06:55 PM
RE: code to run in python3 - by heiner55 - Nov-13-2017, 03:16 AM
RE: code to run in python3 - by Skaperen - Nov-13-2017, 04:03 AM
RE: code to run in python3 - by wavic - Nov-13-2017, 08:47 AM
RE: code to run in python3 - by Skaperen - Nov-13-2017, 09:44 AM
RE: code to run in python3 - by wavic - Nov-13-2017, 10:15 AM
RE: code to run in python3 - by Skaperen - Nov-14-2017, 01:02 AM
RE: code to run in python3 - by metulburr - Nov-14-2017, 02:19 AM
RE: code to run in python3 - by Skaperen - Nov-14-2017, 07:07 AM
RE: code to run in python3 - by metulburr - Nov-14-2017, 06:48 PM
RE: code to run in python3 - by Skaperen - Nov-15-2017, 01:15 AM
RE: code to run in python3 - by metulburr - Nov-15-2017, 01:41 AM
RE: code to run in python3 - by Skaperen - Nov-15-2017, 02:47 AM
RE: code to run in python3 - by metulburr - Nov-15-2017, 04:41 AM
RE: code to run in python3 - by Skaperen - Nov-16-2017, 03:31 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What the difference between python2 and python3 when they running my code. lpangfeic 1 1,865 Nov-19-2019, 04:44 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020