- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用 virtualenv在我的 Ubuntu 14.04 服务器上,但我似乎无法安装 gevent
。我首先激活 virtualenv,然后使用 pip 安装 gevent
:
$ source venv/bin/activate
(venv)immoh@vgmt:~/immod$ sudo pip install gevent
The directory '/home/immoh/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/immoh/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): gevent in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.4.7 in /usr/local/lib/python2.7/dist-packages (from gevent)
在此之后,我尝试从 python 命令行使用它:
(venv)immoh@vgmt:~/immod$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gevent
>>>
这似乎没有用,所以我尝试按照上面消息的建议使用 sudo 的 -H 标志
安装它,但在那之后,我又无法导入 gevent
:
(venv)immoh@vgmt:~/immod$ sudo -H pip install gevent
Requirement already satisfied (use --upgrade to upgrade): gevent in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied (use --upgrade to upgrade): greenlet>=0.4.7 in /usr/local/lib/python2.7/dist-packages (from gevent)
(venv)immoh@vgmt:~/immoh$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gevent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gevent
有谁知道我在这里做错了什么以及我该如何解决这个问题?欢迎所有提示!
最佳答案
问题的根源是您在不应该使用的情况下使用了 sudo
。在 virtualenv 中工作后,只需运行不带 sudo
的 pip
,您应该不会遇到这些问题。
顺便说一句,我建议创建一个新的 virtualenv 来尝试这个,以避免您之前的尝试造成的任何问题。
关于python - 如何在 Python virtualenv 中安装 gevent?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32710361/
我的图书馆是否有任何“官方”方式可以测试 gevent monkey 补丁是否已激活? 最佳答案 我不知道官方方法,但这是一种方法。 注意 os.fork 在猴子修补时发生变化: >>> import
存储在 threading.local 中的数据对于特定的协同例程来说是唯一的,还是对于 Python 线程来说仍然是唯一的? 最佳答案 根据 gevent.monkey 的文档 http://www
经过一整天的黑客攻击并试图找出问题所在后,我问了这个问题。 我想使用 requests 包发送请求,并以非阻塞模式进行。 为此,我使用了很好的 gevent 包及其猴子修补功能,我已经使用它很长时间了
我正在把我的头发拉到这个上面。我正在尝试使用 zeromq 和 gevent 获取最简单的示例。我将此脚本更改为使用 PUB/SUB 套接字,当我运行它时,“服务器”套接字将永远循环。如果我取消注释
我正在使用 Flask 和 Flask-SocketIO 构建 Web 接口(interface)/数据 API 以进行 websocket 通信。我想开始转向使用 Gevent/Gevent-web
假设 tasks 是 Greenlet 对象的列表。现在有什么区别 gevent.wait(tasks) 和 gevent.joinall(tasks) ? 最佳答案 不多! joinall 实际上在
我有一个使用线程的 python bottle 应用程序。因为我正在使用 monkey.patch ,线程正在阻止应用程序执行(从线程触发的对话框阻止瓶路由响应客户端,直到被关闭。) 这里的一项小研究
在 gevent monkey 补丁中,我没有看到任何关于默认文件对象的操作。如何在基于 gevent 的程序中使用异步文件读/写? 最佳答案 您可以使用 1.0b3 中可用的 gevent 的 fi
过去几天,我一直在尝试将事件流集成到我的 Flask 应用程序中,在我的本地测试中取得了不错的结果,但在我的服务器上使用 uWSGI 运行该应用程序时却有些糟糕。我的代码基本上建立在 example
来自 gevent 文档: The greenlets all run in the same OS thread and are scheduled cooperatively. 那么是否仍然需要使
我在 Gevent 池中执行几十个 HTTP 请求。 目标是在请求失败时重试一次,但仅重试一次。否则,它应该抛出异常。 我如何使用 at pool 编写 gevent 代码以支持在失败时重新运行一次
简而言之,我的问题是:我怎么知道某个特定的 Python 包何时与 gevent 兼容(至少与 gevent.monkey.patch_all 兼容)? 其实我想知道是否http-parser库与 g
为什么 gevent 会抛出这个错误?在 ipython、ubuntu 13 中运行它 In [1]: from gevent import monkey In [2]: monkey.patch_a
在我基于 gevent 的程序中,我在某处有一个线程,它陷入了一个循环,类似于: while True: gevent.sleep(0) 我怎么知道这是哪个线程?是否可以列出(并获取堆栈跟踪)
运行 gevent 的 WSGIServer 时,我遇到了一些非常奇怪的行为。似乎每个通过的请求的方法都被错误地解释了.. 如果我发送以下请求: requests.get('http://localh
我的项目正在使用 gevnet(这对我来说是新的)来实现 Thrift 服务器。 我正在阅读代码并从其文档中学习。下面的代码片段在我的项目中: TSocket.socket = gevent.sock
我尝试在我的 osX (el capitan) 上安装 Odoo。然后我下载了这个包,当我尝试使用 pip install -r requirements.txt 安装 3rf party lib 时
我有多个 greenlets 在一个公共(public)套接字上发送。是否保证通过 socket.sendall 发送的每个包都很好地分开,或者我是否必须在每次调用 sendall 之前获取锁。 所以
我刚开始使用 virtualenv,但我正在尝试安装 gevent在 virtualenv 环境中(我正在运行 Windows)。当我在 virtualenv 中使用 PIP 时,出现此错误: MyE
目前我正在使用带有发布-订阅模式的 zeromq,我有一个工作人员要发布和许多 (8) 个订阅者(都将订阅)相同的模式。 现在我尝试使用多处理来生成订阅者,它可以正常工作。我缺少一些消息。 我使用多处
我是一名优秀的程序员,十分优秀!