You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyPI模块上传后安装失败求助:mousecontroller模块构建Wheel报错

Fixing "No such file or directory: 'm'" Error When Installing mousecontroller from PyPI

Looks like that frustrating error boils down to a small syntax misstep in your setup.py file—let's get it sorted out quickly!

What's Causing the Error?

The log shows it's looking for a file named 'm' because you passed a single string to the scripts parameter in the setup() function. Setuptools expects scripts to be a list of file paths, not a single string. When you pass just 'mousecontroller.py', Python treats that string as an iterable, so it tries to process each character as a separate script file—starting with the first character, 'm', which obviously doesn't exist as a file.

Corrected setup.py Code

Here's the fixed version, with the critical change to the scripts line (now wrapped in square brackets to make it a list):

from setuptools import setup, find_packages

setup(
    name='mousecontroller',
    version='1.0.2',
    author='(我的姓名)',
    author_email='(我的邮箱)',
    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'],  # Changed to a list instead of single string
    install_requires=['pypiwin32', 'keyboard'],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
)

Bonus: Modern Alternative to scripts

For better compatibility across environments, modern Python packaging recommends using entry_points instead of scripts. If you want to update to this approach, replace the scripts line with this:

entry_points={
    'console_scripts': [
        'mousecontroller=mousecontroller:main',  # Replace 'main' with your actual entry function name
    ],
}

Just ensure your mousecontroller.py has a main() function that triggers your tool's core logic.

Next Steps

After updating your setup.py, rebuild your package with:

python setup.py sdist bdist_wheel

Then re-upload to PyPI using twine, and running pip install mousecontroller should work without that error.

内容的提问来源于stack exchange,提问作者Atomic Peanut

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 18:22:43