当我们安装python的 gevent包的时候,有时候很遗憾会安装失败,希望您的失败和我的一样的原因,这样就能帮你解决问题了,安装错误信息如下:
sudo pip install gevent
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gevent
Using cached https://files.pythonhosted.org/packages/c8/18/631398e45c109987f2d8e57f3adda161cc5ff2bd8738ca830c3a2dd41a85/gevent-21.12.0.tar.gz
Installing build dependencies ... error
Complete output from command /usr/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ix_DdY --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- "setuptools >= 40.8.0" wheel "Cython >= 3.0a9" "cffi >= 1.12.3 ; platform_python_implementation == 'CPython'" "greenlet >= 0.4.17, < 2.0 ; platform_python_implementation == 'CPython'":
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting setuptools>=40.8.0
Using cached https://files.pythonhosted.org/packages/e1/b7/182161210a13158cd3ccc41ee19aadef54496b74f2817cc147006ec932b4/setuptools-44.1.1-py2.py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl
Collecting Cython>=3.0a9
Using cached https://files.pythonhosted.org/packages/c4/7c/293f5e9311664af5f54ca46dcb2118fc1b4e551eec161f74c050f17cd991/Cython-3.0.0a10-py2.py3-none-any.whl
Collecting cffi>=1.12.3
Using cached https://files.pythonhosted.org/packages/2b/a8/050ab4f0c3d4c1b8aaa805f70e26e84d0e27004907c5b8ecc1d31815f92a/cffi-1.15.1.tar.gz
Collecting greenlet<2.0,>=0.4.17
Collecting pycparser (from cffi>=1.12.3)
Using cached https://files.pythonhosted.org/packages/62/d5/5f610ebe421e85889f2e55e33b7f9a6795bd982198517d912eb1c76e1a53/pycparser-2.21-py2.py3-none-any.whl
Building wheels for collected packages: cffi
Running setup.py bdist_wheel for cffi: started
Running setup.py bdist_wheel for cffi: finished with status 'error'
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Ez5ALp/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-lxLCdt --python-tag cp27:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/pkgconfig.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/__init__.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-armv7l-2.7
creating build/temp.linux-armv7l-2.7/c
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-InigCj/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for cffi
Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: setuptools, wheel, Cython, pycparser, cffi, greenlet
Running setup.py install for cffi: started
Running setup.py install for cffi: finished with status 'error'
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Ez5ALp/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ffnMrz/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-ix_DdY --compile:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/cffi
copying cffi/vengine_gen.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/error.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/cparser.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/commontypes.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/ffiplatform.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/pkgconfig.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/api.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/model.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/recompiler.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/__init__.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/verifier.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/lock.py -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_cffi_include.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/parse_c_type.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_embedding.h -> build/lib.linux-armv7l-2.7/cffi
copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-2.7/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-armv7l-2.7
creating build/temp.linux-armv7l-2.7/c
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-InigCj/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DFFI_BUILDING=1 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-Ez5ALp/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ffnMrz/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-ix_DdY --compile" failed with error code 1 in /tmp/pip-install-Ez5ALp/cffi/
----------------------------------------
Command "/usr/bin/python -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-ix_DdY --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- "setuptools >= 40.8.0" wheel "Cython >= 3.0a9" "cffi >= 1.12.3 ; platform_python_implementation == 'CPython'" "greenlet >= 0.4.17, < 2.0 ; platform_python_implementation == 'CPython'"" failed with error code 1 in None
执行以下命令:
python -m pip install --upgrade pip
pi@pi:~/HeatMap $ python -m pip install --upgrade pip
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pip
Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 172kB/s
Installing collected packages: pip
Successfully installed pip-20.3.4
执行以下命令:
pip3 install gevent
提示信息如下:
pi@pi:~/HeatMap $ pip3 install gevent
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting gevent
Downloading https://www.piwheels.org/simple/gevent/gevent-21.12.0-cp37-cp37m-linux_armv7l.whl (2.7MB)
100% |████████████████████████████████| 2.7MB 28kB/s
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from gevent) (40.8.0)
Collecting greenlet<2.0,>=1.1.0; platform_python_implementation == "CPython" (from gevent)
Downloading https://www.piwheels.org/simple/greenlet/greenlet-1.1.2-cp37-cp37m-linux_armv7l.whl (161kB)
100% |████████████████████████████████| 163kB 152kB/s
Collecting zope.event (from gevent)
Downloading https://files.pythonhosted.org/packages/9e/85/b45408c64f3b888976f1d5b37eed8d746b8d5729a66a49ec846fda27d371/zope.event-4.5.0-py2.py3-none-any.whl
Collecting zope.interface (from gevent)
Downloading https://www.piwheels.org/simple/zope-interface/zope.interface-5.4.0-cp37-cp37m-linux_armv7l.whl (240kB)
100% |████████████████████████████████| 245kB 43kB/s
Installing collected packages: greenlet, zope.event, zope.interface, gevent
Successfully installed gevent-21.12.0 greenlet-1.1.2 zope.event-4.5.0 zope.interface-5.4.0
安装成功!
代码如下:chmod +w /etc/sudoers
vim /etc/sudoers
添加一行 代码如下:username ALL=(ALL) ALL其中username是你的用户名,保存
更改sudoers文件权限
代码如下:chmod 0440 /etc/sudoers
退出root
ok可以了,试试?;-)
方法一:再继续查,提示跟环境和版本有关,环境不支持32位的,如果是32位就换成64位的python,还有版本要在3.7 以下,降成3.6和3.5都可以,我的环境是64位的,降成3.6 版本后试了下无效,但是大家可以试下,可能有效。方法三:pip install 安装包名字 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn //清华大学。根据自己电脑的Python版本下载对应的whl包。
为Python安装gevent模块
大家好,今天在给我的windows安装gevent模块里,遇到一个问题,分享给大家,方便大家日后在遇到同样的问题时,可以快速的解决,具体情况如下:
1、安装方法:pip install gevent
2、安装过程中,在线自动下载安装包后,无法进行到下一步,一直会报错:ERROR: Command errored out with exit status 1: p...
pi@raspberrypi:~ $ cd /home/pi/it
pi@raspberrypi:~/it $ sudo -i python3 /home/pi/it/music.py
SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set.
报错关键字:Building wheel for numpy (PEP 517): started
Building wheel for numpy (PEP 517): still running...
pip subprocess to install backend dependencies did not run successfully.
This error originates from a subprocess, and is likely not a pr
Running setup.py install for cffi ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9stiwxpi/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
利用pip安装superset模块时出现错误No package 'libffi' found,检查后发现是因为缺少libffi库文件,利用以下命令安装,解决问题:sudo yum install libffi-devel
[root@python2 opt]# pip install scrapy
Collecting scrapy
Downloading Scrapy-1.3.3-py2.py3-none-
ip install pillow
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting p...
背景:python文件中引用了gevent库 部署到linux服务器后提示nomodel name gevent 所以想要使用pip进行安装,但安装pip的时候提示:pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
大概意思就是pip没有ssl模块 所以无法安装
尝试:使用python2.7
import ssl
没有报错。说明o...
通过以上的介绍,我们了解了gevent库的协程特性和使用方法,并且通过一个简单的示例来演示了如何使用gevent库提高Python程序的网络IO效率。在实际的开发中,我们可以根据自己的需求来充分利用gevent库的协程特性,以达到更高的并发处理能力和更好的性能表现。
例如,它可以直接对socket进行协程化,这样我们就可以使用更简单的API来完成网络编程。总结来说,gevent这个库是Python中非常实用的一个网络库,它具有高效、易用等特点,并且还支持许多高级特性。在编写高并发的网络程序时,可以优先考虑使用gevent来实现。Py中gevent库是一个基于协程的Python网络库,它利用greenlet实现并发。可以看到,使用gevent进行异步并发操作可以极大地缩短程序的运行时间。可以看到,使用gevent库进行异步并发操作可以大幅提高程序的性能。
查看系统架构
root@raspberrypi:~# uname -a
Linux raspberrypi 5.10.17-v7l+ #1414 SMP Fri Apr 30 13:20:47 BST 2021 armv7l GNU/Linux
安装torch和torchvision
https://torch.maku.ml/whl/stable.html
安装torch
root@raspberrypi:~# pip install torch -f https://torch.maku.ml/wh