我正在尝试使用setuptools和麻线将python模块上传到PyPI。我的模块可以在https://pypi.org/project/mousecontroller/.如果您尝试使用pip install mousecontroller
安装模块,您将遇到错误:
Collecting mousecontroller
Using cached mousecontroller-1.0.2.tar.gz (1.4 kB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pypiwin32 in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packa
ges (from mousecontroller) (223)
Requirement already satisfied: keyboard in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-packag
es (from mousecontroller) (0.13.5)
Requirement already satisfied: pywin32>=223 in c:usersmeappdatalocalpackagespythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0localcachelocal-packagespython39site-pa
ckages (from pypiwin32->mousecontroller) (304)
Building wheels for collected packages: mousecontroller
Building wheel for mousecontroller (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
running bdist_wheel
running build
running build_scripts
creating build
creating buildscripts-3.9
error: [Errno 2] No such file or directory: 'm'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mousecontroller
Running setup.py clean for mousecontroller
Failed to build mousecontroller
Installing collected packages: mousecontroller
Running setup.py install for mousecontroller ... error
error: subprocess-exited-with-error
× Running setup.py install for mousecontroller did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
running install
C:UsersmeAppDataLocalPackagesPythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0LocalCachelocal-packagesPython39site-packagessetuptoolscommandinstall.py:34:
SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_scripts
creating build
creating buildscripts-3.9
error: file 'C:UsersmeAppDataLocalTemppip-install-60u406ebmousecontroller_e9ecf1693b5a49f6aa898bb92d39281am' does not exist
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> mousecontroller
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
我已经对这个问题做了一些研究,但仍然没有发现任何与我相关的东西,也没有发现如何解决这个问题。这是我的setup.py
文件:
from setuptools import setup, find_packages
setup(
name='mousecontroller',
version='1.0.2',
author='(my name)',
author_email='(my e-mail)',
packages=find_packages(),
url='https://pypi.org/project/mousecontroller/',
license='LICENSE',
description='A python package to easily control the mouse in realistic and fluent ways.',
long_description=open('README.md', 'r').read(),
long_description_content_type="text/markdown",
scripts='mousecontroller.py',
install_requires=['pypiwin32', 'keyboard'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
)
注意:我编辑了代码和日志以保护我的一些个人信息。
您的script=
行不正确,请参阅文档:
脚本选项只是文件列表
您只将脚本作为字符串提供,当将其作为列表处理时,会将其拆分为各个字符。这就是为什么错误消息说找不到C:UsersmeAppDataLocalTemppip-install-60u406ebmousecontroller_e9ecf1693b5a49f6aa898bb92d39281am
的原因。
使用方括号修复:
scripts=['mousecontroller.py']
旁注
mousecontroller.py
不在PyPi上可用的CCD_ 5中。可能是出于同样的原因。