easy_install fails on error “Couldn't find setup script” after binary upload?

断了今生、忘了曾经 提交于 2020-01-13 08:10:09

问题


After uploading a binary distribution of my Python C extension with python setup.py bdist upload, easy_install [my-package-name] fails on "error: Couldn't find a setup script in /tmp/easy_install/package-name-etc-etc".

What am I doing wrong?


回答1:


This may not be related to your specific problem, but I am providing this information in case it is helpful to others.

I hit exactly this error when running easy_install xyz. The problem turned out to be that I had a subdirectory named xyz in the current working directory and easy_install was expecting to find a setup script locally in that subdirectory instead of going out to the web to get the real xyz. Renaming my local xyz directory temporarily fixed the problem.

This is one of a number of situations in which the command line argument you provide can be unintentionally shadowed by a file or folder of the same name. Another example is make: if you run make test in an attempt to make your test target and you happen to have a folder named test then make will not do what you want. The solution in that case is to indicate Phony Targets.




回答2:


easy_install expects to find either a source distribution, or an egg. It's best to upload source distributions (sdist) to PyPI (or whatever distribution server you are using), and only upload eggs if your python package contains C extensions, and then only for Windows eggs (see my answer to Can I create a single egg for multiple versions of python?).

The bdist command, without additional configuration, creates a .tar.gz or .zip archive containing the compiled python files (and any C extensions compiled) for your current platform, sans installer (so not including the setup.py file). It's intended for unpacking by hand in your site-packages location and pre-dates distribution via eggs. If you were to unzip it, you'll notice it even included the full, absolute path to your site-packages directory in the tarball!

You can configure bdist to generate a RPM or a .deb file, or a simple Windows installer, but these are again aimed at providing installation bundles for other distribution systems not related to PyPI and easy_install.

So, to summarize, in most cases it's best to upload an sdist source distribution and have easy_install do the python compilation (into an egg) on installation.

If you do want to upload a pre-compiled distribution (which is then tied to specific Python version and the platform for which it was compiled), use the bdist_egg command instead.




回答3:


Sometimes you don't actually really intend to easy_install the 'directory', which will look for a setup.py file. In simple words, you may be doing easy_install xyz/ while what you really want to do is easy_install xyz



来源:https://stackoverflow.com/questions/6178664/easy-install-fails-on-error-couldnt-find-setup-script-after-binary-upload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!