简体   繁体   English

即使安装了名为 gevent 的模块

[英]no module named gevent even though it is installed

OS : Ubuntu 16.04 Python 2.7操作系统:Ubuntu 16.04 Python 2.7

pip list | grep gev
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
gevent (1.3a2)

Just to make sure, I checked:为了确保,我检查了:

  pip install --upgrade gevent
Requirement already up-to-date: gevent in /home/user/.local/lib/python2.7/site-packages
Requirement already up-to-date: greenlet>=0.4.13; platform_python_implementation == "CPython" in /home/user/.local/lib/python2.7/site-packages (from gevent)

However when I actually run my python program it bails out with an error:但是,当我实际运行我的 python 程序时,它会出现错误:

 import gevent
ImportError: No module named gevent

Please advise.请指教。

Stuff I already tried:我已经尝试过的东西:

pip --version
pip 9.0.1 from /home/user/.local/lib/python2.7/site-packages (python 2.7)


python -m pip install --user gevent
Requirement already satisfied: gevent in /home/user/.local/lib/python2.7/site-packages
Requirement already satisfied: greenlet>=0.4.13; platform_python_implementation == "CPython" in /home/user/.local/lib/python2.7/site-packages (from gevent)

which -a python
/usr/bin/python
/usr/bin/python

along with things mentioned here: https://github.com/PokeAlarm/PokeAlarm/issues/22以及这里提到的事情: https : //github.com/PokeAlarm/PokeAlarm/issues/22

I also tried uninstalling the pip installation and doing apt-get :我还尝试卸载 pip 安装并执行 apt-get :

sudo apt-get install python-gevent python-gevent-websocket

mentioned here: https://askubuntu.com/questions/836029/importerror-no-module-named-gevent/1013457#1013457这里提到: https : //askubuntu.com/questions/836029/importerror-no-module-named-gevent/1013457#1013457

Working in a Python virtual environment in Ubuntu 16.04 I got the following results:在 Ubuntu 16.04 的 Python 虚拟环境中工作,我得到以下结果:

$ python -m pip install gevent 
Requirement already satisfied: gevent in ./lib/python2.7/site-packages  
Requirement already satisfied: greenlet>=0.4.10 in ./lib/python2.7/site-packages (from gevent)

import gevent worked successfully in my Python virtual environment, but it did not work outside of my Python virtual environment until I ran the following command: import gevent在我的 Python 虚拟环境中成功运行,但在我运行以下命令之前,它无法在我的 Python 虚拟环境之外运行:

sudo apt install python-gevent # also works in all currently supported versions of Ubuntu 

Description: gevent is a coroutine-based Python networking library.描述:gevent 是一个基于协程的 Python 网络库。 gevent uses greenlet to provide a high-level synchronous API on top of libevent event loop. gevent 使用 greenlet 在 libevent 事件循环之上提供高级同步 API。

You can also install python3-gevent for Python 3.x in all currently supported versions of Ubuntu by running the following command:您还可以通过运行以下命令在所有当前支持的 Ubuntu 版本中为 Python 3.x 安装 python3-gevent:

sudo apt install python3-gevent

make sure that your pip references the same python that you are using, on many systems you can have multiple python versions installed.确保您的 pip 引用您正在使用的同一个 python,在许多系统上,您可以安装多个 python 版本。 you can see which to which python your pip belongs by running:您可以通过运行来查看您的 pip 属于哪个 python:

pip --version

enter image description here在此处输入图片说明

goto anaconda navigator and select the environment on which you are working ...then select not installed ,check for gevent and install转到 anaconda navigator 并选择您正在工作的环境...然后选择未安装,检查 gevent 并安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使已安装,也没有名为 scipy 的模块 - No module named scipy even though it is installed ImportError:即使已安装模块,也没有名为请求的模块 - ImportError: No module named requests - even though it is installed ImportError:即使安装了适用于python的google-cloud,也没有名为Cloud的模块 - ImportError: No module named cloud even though google-cloud for python is installed 即使模块已安装,也会发生ImportError - ImportError even though the module is already installed Python没有命名模块,即使该模块确实出现 - Python No module named, even though the module does appear 没有名为selenium的模块(即使安装成功也没有在文件夹中) - No module named selenium (and not in folder, even though installation was successful) 为什么即使安装了 FBX 模块也找不到? - Why does it say FBX module not found even though it is installed? 即使我使用 pip 安装了请求,“没有名为请求的模块” - 'No module named requests' even if I installed requests with pip 由Miniconda安装的ImportError``No Module Named Pandas'' - ImportError ''No Module Named Pandas'', installed by Miniconda 没有安装名为matplotlib且带有matplotlib的模块python 2.7 - No module named matplotlib with matplotlib installed Python 2.7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM