python setup.py bdist_wheel 报错的处理办法 admin 2023-08-28 14:54:01 篇首语:本文由小编为大家整理,主要介绍了python setup.py bdist_wheel 报错的处理办法相关的知识,希望对你有一定的参考价值。 参考技术A 错误描述:在虚拟环境里安装 tornado 报错:error: invalid command "bdist_wheel" 多半是setuptools版本不正确或者你的环境中没有安装wheel: 执行之后 果然 没有报错了。 python 从setup.json读取的示例setup.py # -*- coding: utf-8 -*-## setup.py#SETUP_JSON = "setup.json"import ioimport jsonimport osimport sysfrom shutil import rmtreefrom setuptools import setup, find_packages, CommandHERE = os.path.abspath(os.path.dirname(__file__))def load_json(path, here=HERE): """""" with io.open(os.path.join(here, path)) as f: return json.load(f)def get_long_description(path, default="", here=HERE): """""" long_description = default with io.open(os.path.join(here, path), encoding="utf-8") as f: long_description = " " + f.read() return long_descriptiondef get_version(path, key="__version__", here=HERE): """""" version = {} with open(os.path.join(here, path)) as f: exec(f.read(), version) return version[key]class Upload(Command): """""" name = "upload" description = "Build and publish the package." user_options = [] @staticmethod def status(s): """Prints things in bold.""" print(" 33[1m{0} 33[0m".format(s)) def initialize_options(self): """""" def finalize_options(self): """""" def run(self): """""" try: self.status("Removing previous builds…") rmtree(os.path.join(HERE, "dist")) except OSError: pass self.status("Building Source and Wheel (universal) distribution...") os.system(f"{sys.executable} setup.py sdist bdist_wheel --universal") self.status("Uploading the package to PyPI via Twine...") os.system("twine upload --repository-url https://upload.pypi.org/legacy/ dist/*") sys.exit()if __name__ == "__main__": about = load_json(SETUP_JSON) about["version"] = get_version(about["version_file"]) del about["version_file"] about["long_description"] = get_long_description(about["long_description_file"]) del about["long_description_file"] if "exclude" in about["packages"]: about["packages"] = find_packages(exclude=tuple(about["packages"]["exclude"])) setup(cmdclass={Upload.name: Upload}, **about) 以上是关于python setup.py bdist_wheel 报错的处理办法的主要内容,如果未能解决你的问题,请参考以下文章 Linux 网络配置 修改DNS配置文件/etc/resolv.conf后,重启网络,DNS配置丢失 el-upload上传图片 您可能还会对下面的文章感兴趣: 相关文章 浏览器打不开网址提示“ERR_CONNECTION_TIMED_OUT”错误代码的解决方法 如何安装ocx控件 VMware的虚拟机为啥ip地址老是自动变化 vbyone和EDP区别 linux/debian到底怎么重启和关机 苹果平板键盘被弄到上方去了,如何调回正常? 机器学习常用距离度量 如何查看kindle型号