我正在尝试安装 pyautogui,但 pip 不断抛出错误。如何修复它?我尝试安装 libffi 库。这是一些代码:
python3 -m pip install pyautogui
Defaulting to user installation because normal site-packages is not writeable
Collecting pyautogui
Using cached PyAutoGUI-0.9.50.tar.gz (57 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sxm4ewnq/pyautogui/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sxm4ewnq/pyautogui/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-85ugzov6
cwd: /tmp/pip-install-sxm4ewnq/pyautogui/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist …Run Code Online (Sandbox Code Playgroud) 当我尝试使用 Python 3.10 安装 numpy 时,我收到此消息。
如何解决这个问题?
Copying numpy.egg-info to build/bdist.linux-x86_64/wheel/numpy-1.19.3-py3.10.egg-info
running install_scripts
Traceback (most recent call last):
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/walenty/.local/lib/python3.10/site-packages/pip/_vendor/pep517/_in_process.py", line 204, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 211, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 197, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 248, in run_setup
super(_BuildMetaLegacyBackend,
File "/tmp/pip-build-env-plb3t7s6/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 508, …Run Code Online (Sandbox Code Playgroud) 我创建了一个 svelte 项目并想使用 prettier。我有更漂亮的精简插件。
pnpm exec prettier --write .
Run Code Online (Sandbox Code Playgroud)
只会获取 js 和 html 文件。
pnpm exec prettier --write .src/routes/+page.svelte
Run Code Online (Sandbox Code Playgroud)
或者
pnpm exec prettier --write . **.svelte
Run Code Online (Sandbox Code Playgroud)
将正常工作并拾取所有文件。
难道不是预期的行为或更漂亮地拾取纤细的文件吗?为什么它不接他们?
我正在创建一个应用程序,我需要在初始渲染时创建一个对象并在整个组件生命周期中保留它。
\n我的代码现在看起来像这样:
\nfunction Component() {\n const obj = useRef(new Smth());\n return (\n <div>\n <button onClick={obj.current.p}>p</button>\n <button onClick={obj.current.c}>c</button>\n </div>\n );\n};\nRun Code Online (Sandbox Code Playgroud)\nReact 文档说:
\n\n\nuseRef 返回一个可变的 ref 对象,其 .current 属性被初始化为传递的参数 (initialValue)。返回的对象将在组件的整个生命周期内持续存在。
\n
来自: https: //reactjs.org/docs/hooks-reference.html#useref
\n看来我使用得当。然而,Hooks FAQ 说:
\n\n\n您有时可能还想避免重新创建 useRef() 初始值。例如,也许您想确保某些命令式类实例仅创建一次:
\n
function Image(props) {\n // \xe2\x9a\xa0\xef\xb8\x8f IntersectionObserver is created on every render\n const ref = useRef(new IntersectionObserver(onIntersect));\n // ...\n}\n\nRun Code Online (Sandbox Code Playgroud)\n\n\nuseRef 不接受像 useState 这样的特殊函数重载。相反,您可以编写自己的函数来延迟创建和设置它:
\n
\nfunction Image(props) {\n const ref …Run Code Online (Sandbox Code Playgroud)