gpt4 book ai didi

python - 在虚拟环境中安装 gevent

转载 作者:可可西里 更新时间:2023-11-01 09:25:44 28 4
gpt4 key购买 nike

我刚开始使用 virtualenv,但我正在尝试安装 gevent在 virtualenv 环境中(我正在运行 Windows)。当我在 virtualenv 中使用 PIP 时,出现此错误:

MyEnv>pip install gevent
Downloading/unpacking gevent
Running setup.py egg_info for package gevent
Please provide path to libevent source with --libevent DIR

包索引有用于在 Windows 上安装的 MSI 和 EXE (http://pypi.python.org/pypi/gevent/0.13.7),但我不知道如何将它们安装到 virtualenv 环境(或如果可能的话)。当我从 virtualenv promp 尝试 pip install gevent-0.13.7.win32-py2.7.exe 时,我也收到错误:

ValueError: ('Expected version spec in', 'D:\\Downloads\\gevent-0.13.7.win32-py2.7.exe', 'at', ':\\Downloads\\gevent-0.13.7.win32-py2.7.exe')

有人知道怎么做吗?

最佳答案

Pip 还不支持安装二进制包。如果你想从二进制包安装,你必须使用 easy_install - easy_install gevent-0.13.7.win32-py2.7.exe

Microsoft Windows XP [Wersja 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Z:\>virtualenv z:\venv\gevent-install
New python executable in z:\venv\gevent-install\Scripts\python.exe
Installing distribute..................................................................................................
............................................................................................done.
Installing pip.................done.

Z:\>venv\gevent-install\Scripts\activate
(gevent-install) Z:\>easy_install c:\python\packages\gevent-0.13.7.win32-py2.7.exe
Processing gevent-0.13.7.win32-py2.7.exe
creating 'c:\docume~1\pdobro~1\ustawi~1\temp\easy_install-b5nj3i\gevent-0.13.7-py2.7-win32.egg' and adding 'c:\docume~1
pdobro~1\ustawi~1\temp\easy_install-b5nj3i\gevent-0.13.7-py2.7-win32.egg.tmp' to it
creating z:\venv\gevent-install\lib\site-packages\gevent-0.13.7-py2.7-win32.egg
Extracting gevent-0.13.7-py2.7-win32.egg to z:\venv\gevent-install\lib\site-packages
Adding gevent 0.13.7 to easy-install.pth file

Installed z:\venv\gevent-install\lib\site-packages\gevent-0.13.7-py2.7-win32.egg
Processing dependencies for gevent==0.13.7
Searching for greenlet
Reading http://pypi.python.org/simple/greenlet/
Reading http://bitbucket.org/ambroff/greenlet
Reading https://github.com/python-greenlet/greenlet
Best match: greenlet 0.3.4
Downloading http://pypi.python.org/packages/2.7/g/greenlet/greenlet-0.3.4-py2.7-win32.egg#md5=9941aa246358c586bb274812e
130629
Processing greenlet-0.3.4-py2.7-win32.egg
creating z:\venv\gevent-install\lib\site-packages\greenlet-0.3.4-py2.7-win32.egg
Extracting greenlet-0.3.4-py2.7-win32.egg to z:\venv\gevent-install\lib\site-packages
Adding greenlet 0.3.4 to easy-install.pth file

Installed z:\venv\gevent-install\lib\site-packages\greenlet-0.3.4-py2.7-win32.egg
Finished processing dependencies for gevent==0.13.7

(gevent-install) Z:\>

参见 Can I install Python windows packages into virtualenvs?另一种选择是从源代码安装,您可以使用 pip 执行此操作,但这需要设置编译器和环境,这比上面的简单命令要难得多。

关于python - 在虚拟环境中安装 gevent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10746030/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com