-->

how to fix distutils.errors.DistutilsError on py2a

2019-07-08 03:07发布

问题:

I recently tried to use py2app and I have a simple app named test.py. everything is fine, until I type 'python3 setup.py py2app'. here is the error message:

Download error on https://pypi.python.org/simple/py2app/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) -- Some packages may not be found! Couldn't find index page for 'py2app' (maybe misspelled?) Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) -- Some packages may not be found! No local packages or working download links found for py2app Traceback (most recent call last): File "setup.py", line 18, in setup_requires=['py2app'], File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup _setup_distribution = dist = klass(attrs) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/setuptools/dist.py", line 315, in init self.fetch_build_eggs(attrs['setup_requires']) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs replace_conflicting=True, File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/pkg_resources/init.py", line 850, in resolve dist = best[req.key] = env.best_match(req, ws, installer) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/pkg_resources/init.py", line 1122, in best_match return self.obtain(req, installer) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/pkg_resources/init.py", line 1134, in obtain return installer(requirement) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/setuptools/dist.py", line 429, in fetch_build_egg return cmd.easy_install(req) File "/Users/dariushmazlumi/Desktop/test/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 659, in easy_install raise DistutilsError(msg) distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('py2app')

I'm using python3.6 on macOS sierra.

回答1:

There is a reported python bug that was caused by Apple no longer installing open SSL. See this discussion.



回答2:

after a week trying to fix my problem, I found out why my py2app, pip, and ... are not working. it is my antivirus(Kaspersky) problem. today, when opening google.com, I understand that I had a problem opening any page. I had same problem on other browsers. I read that error message in safari. Kaspersky issued all certificates!(including pip,py2app ...) I fixed it by disabling: kaspersky internet security > preference > protection > check secure connections(https). thanks everyone for their help.