即使“Pip 中的需求已经满足”,也未找到 Python 模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45345377/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python module not found even though "Requirement Already satisfied in Pip"
提问by zoey cluff
writing some python in OS X, and it's saying several packages I installed with pip "ImportError: no module named requests"
在 OS X 中编写一些 python,它说我用 pip “ImportError: no module named requests”安装了几个包
When running pip install requests
运行 pip install 请求时
> sudo -H pip install requests
Requirement already satisfied: requests in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: urllib3<1.22,>=1.21.1 in /usr/local/lib/python2.7/site-packages (from requests)
Requirement already satisfied: idna<2.6,>=2.5 in /usr/local/lib/python2.7/site-packages (from requests)
it's erroring on twindb_cloudflare, requests, group, tarutil, and MySQL DB. I'm able to run the exact same imports on another script (in the same folder) without error.
它在 twindb_cloudflare、requests、group、tarutil 和 MySQL DB 上出错。我能够在另一个脚本(在同一文件夹中)上运行完全相同的导入而不会出错。
回答by Abhishek Parikh
Run in command prompt.
在命令提示符下运行。
pip list
Check what version you have installed on your system if you have an old version.
如果您有旧版本,请检查您在系统上安装的版本。
Try to uninstall the package...
尝试卸载软件包...
pip uninstall requests
Try after to install it:
安装后尝试:
pip install requests
You can also test if pip does not do the job.
您还可以测试 pip 是否无法完成这项工作。
easy_install requests
回答by Daniel Badyan
i had the same issue(also in MAC OS) and solved it by instead running the python script with python3: python3 script.py
我有同样的问题(也在 MAC OS 中)并通过使用 python3 运行 python 脚本来解决它:python3 script.py
in my case i was also using pip3 and not pip.
就我而言,我也在使用 pip3 而不是 pip。