ibeautiful
2023-08-22 16:53:15
我正在嘗試安裝 pyautogui,但 pip 不斷拋出錯誤。如何修復(fù)它?我嘗試安裝 libffi 庫。這是一些代碼:python3 -m pip install pyautoguiDefaulting to user installation because normal site-packages is not writeableCollecting 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 import Distribution File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 34, in <module> from setuptools import windows_support File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module> import ctypes File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module> from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes' ----------------------------------------ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
2 回答

米琪卡哇伊
TA貢獻(xiàn)1998條經(jīng)驗 獲得超6個贊
必需的
安裝外部函數(shù)接口頭
sudo apt install libffi-dev
重新安裝Python
替換所需的 python 版本
烏班圖
sudo add-apt-repository ppa:deadsnakes/ppa -y && sudo apt install --reinstall python3.9-distutils
蘋果系統(tǒng)
使用brew install python3.9
或port install python3.9
(我推薦端口)
視窗
使用微軟商店
指定項目python版本
詩歌
poetry env use 3.9
虛擬環(huán)境
virtualenv -p python3.9 myproject
ETC...

米脂
TA貢獻(xiàn)1836條經(jīng)驗 獲得超3個贊

元芳怎么了
TA貢獻(xiàn)1798條經(jīng)驗 獲得超7個贊
添加回答
舉報
0/150
提交
取消