Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 没有名为'_ctypes';_Python - Fatal编程技术网

Python 没有名为'_ctypes';

Python 没有名为'_ctypes';,python,Python,我正在尝试安装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: Com

我正在尝试安装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 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.
python3-mpip安装pyautogui
默认为用户安装,因为普通站点包不可写
收集pyautogui
使用缓存的PyAutoGUI-0.9.50.tar.gz(57 kB)
错误:命令出错,退出状态为1:
命令:/usr/local/bin/python3-c'import sys,setuptools,tokenize;sys.argv[0]=“”/tmp/pip-install-sxm4ewnq/pyautogui/setup.py”“”__文件uu=“”/tmp/pip-install-sxm4ewnq/pyautogui/setup.py“”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,uuuu文件,“'exec'))'egg\u info--egg base/tmp/pip-pip-egg-info-85ugzov6
cwd:/tmp/pip-install-sxm4ewnq/pyautogui/
完整输出(11行):
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/usr/local/lib/python3.8/site packages/setuptools/_init__.py”,第19行,在
从setuptools.dist导入分发
文件“/usr/local/lib/python3.8/site packages/setuptools/dist.py”,第34行,在
从setuptools导入windows\u支持
文件“/usr/local/lib/python3.8/site packages/setuptools/windows_support.py”,第2行,在
导入ctypes
文件“/usr/local/lib/python3.8/ctypes/_init__.py”,第7行,在
从类型导入联合、结构、数组
ModuleNotFoundError:没有名为“\u ctypes”的模块
----------------------------------------
错误:命令出错,退出状态为1:python setup.py egg_info检查日志以获得完整的命令输出。
这是来自python REPL的

>>> sys.path
['', '/home/walenty/apps/Python-3.8.5/Modules/_ctypes', '/usr/local/lib/python38.zip', '/usr/local/lib/python3.8', '/usr/local/lib/python3.8/lib-dynload', '/home/walenty/.local/lib/python3.8/site-packages', '/usr/local/lib/python3.8/site-packages']
>>> import _ctypes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_ctypes'

>>sys.path
[“”,“/home/walenty/apps/Python-3.8.5/Modules/_ctypes”、“/usr/local/lib/python38.zip”、“/usr/local/lib/python3.8”、“/usr/local/lib/python3.8/lib dynload”、“/home/walenty/.local/lib/python3.8/site packages”、“/usr/local/lib/python3.8/site packages”]
>>>导入类型
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ModuleNotFoundError:没有名为“\u ctypes”的模块

好的,我知道了。这就是答案


我从git克隆了python3.10并从头安装了它。

您是否也尝试过安装
libffi dev
(特别是
-dev
)?是的,我也有这个软件包。您可以发布您的解决方案,作为您自己问题的简短答案,以及您已经完成的步骤。所以这个问题不是没有答案的。并接受它作为正确答案。你也会因此得到一些分数。