如何在 python 虚拟环境中安装 pygobject

如何在 python 虚拟环境中安装 pygobject

我创建了一个 python 虚拟环境,我想将 gi 安装到其中。但它返回此错误。

newtron@newtron:~/Documents/PythonProjects/PyQt/rasp-media$ ./bin/python3 -m pip install PyGObject
Collecting PyGObject
  Downloading PyGObject-3.36.0.tar.gz (714 kB)
     |████████████████████████████████| 714 kB 203 kB/s 
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-0dy6w32x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (23 lines):
  Collecting setuptools
    Downloading setuptools-46.1.3-py3-none-any.whl (582 kB)
  Collecting wheel
    Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting pycairo
    Downloading pycairo-1.19.1.tar.gz (205 kB)
      ERROR: Command errored out with exit status 1:
       command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-od775dbd/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-od775dbd/pycairo/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-install-od775dbd/pycairo/pip-egg-info
           cwd: /tmp/pip-install-od775dbd/pycairo/
      Complete output (11 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
          from setuptools.dist import Distribution, Feature
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
          from setuptools import windows_support
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/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.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-0dy6w32x/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
newtron@newtron:~/Documents/PythonProjects/PyQt/rasp-media$ ./bin/python3 -m pip install PyGObject
Collecting PyGObject
  Using cached PyGObject-3.36.0.tar.gz (714 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-tzvaosca/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (23 lines):
  Collecting setuptools
    Using cached setuptools-46.1.3-py3-none-any.whl (582 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting pycairo
    Using cached pycairo-1.19.1.tar.gz (205 kB)
      ERROR: Command errored out with exit status 1:
       command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-aotbe4p8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aotbe4p8/pycairo/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-install-aotbe4p8/pycairo/pip-egg-info
           cwd: /tmp/pip-install-aotbe4p8/pycairo/
      Complete output (11 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
          from setuptools.dist import Distribution, Feature
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
          from setuptools import windows_support
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/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.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-tzvaosca/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
newtron@newtron:~/Documents/PythonProjects/PyQt/rasp-media$ ./bin/python3 -m pip install PyGObject
Collecting PyGObject
  Using cached PyGObject-3.36.0.tar.gz (714 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ngagzc6u/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (23 lines):
  Collecting setuptools
    Using cached setuptools-46.1.3-py3-none-any.whl (582 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting pycairo
    Using cached pycairo-1.19.1.tar.gz (205 kB)
      ERROR: Command errored out with exit status 1:
       command: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kag8ebvt/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kag8ebvt/pycairo/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-install-kag8ebvt/pycairo/pip-egg-info
           cwd: /tmp/pip-install-kag8ebvt/pycairo/
      Complete output (11 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
          from setuptools.dist import Distribution, Feature
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
          from setuptools import windows_support
        File "/home/newtron/Documents/PythonProjects/PyQt/rasp-media/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.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/newtron/Documents/PythonProjects/PyQt/rasp-media/bin/python3 /home/newtron/Documents/PythonProjects/PyQt/rasp-media/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ngagzc6u/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

还有其他方法可以在虚拟环境中安装 pygobject 吗?

相关内容