[英]PyPI: Problems uploading a module
I am trying to upload a python module to PyPI using setuptools and twine.我正在尝试使用 setuptools 和 twine 将 python 模块上传到 PyPI。 My module can be seen at https://pypi.org/project/mousecontroller/ .
我的模块可以在https://pypi.org/project/mousecontroller/看到。 If you try installing the module using
pip install mousecontroller
, you will encounter an error:如果您尝试使用
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:\users\me\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packa
ges (from mousecontroller) (223)
Requirement already satisfied: keyboard in c:\users\me\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packag
es (from mousecontroller) (0.13.5)
Requirement already satisfied: pywin32>=223 in c:\users\me\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-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 build\scripts-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:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\setuptools\command\install.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 build\scripts-3.9
error: file 'C:\Users\me\AppData\Local\Temp\pip-install-60u406eb\mousecontroller_e9ecf1693b5a49f6aa898bb92d39281a\m' 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.
I have done some research on this problem and still have not found anything relevant to me or how to fix this.我已经对此问题进行了一些研究,但仍未找到与我相关的任何内容或如何解决此问题。 Here is my
setup.py
file:这是我的
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",
],
)
note: I have edited the code and log to protect some of my personal information.注意:我已经编辑了代码和日志以保护我的一些个人信息。
Your script=
line is not correct, see the docs :您的
script=
行不正确,请参阅文档:
The scripts option simply is a list of files
scripts 选项只是一个文件列表
You only provided your script as a string, which is split into individual characters when treated as a list.您仅将脚本作为字符串提供,当作为列表处理时,它会被拆分为单个字符。 That is why the error message says that
C:\Users\me\AppData\Local\Temp\pip-install-60u406eb\mousecontroller_e9ecf1693b5a49f6aa898bb92d39281a\m
is not found.这就是为什么错误消息说没有
C:\Users\me\AppData\Local\Temp\pip-install-60u406eb\mousecontroller_e9ecf1693b5a49f6aa898bb92d39281a\m
的原因。
Fix by using squared brackets:使用方括号修复:
scripts=['mousecontroller.py']
Side Note边注
mousecontroller.py
is not in the .tar.gz
that is available on PyPi.不在 PyPi 上可用的
.tar.gz
中。 Might be due to the same reason.可能是同一个原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.