我没有想办法解决这个问题。
我安装了python/pip
并且它有效..但我无法在我的python脚本中导入 请求模块 。
如果我启动此命令:
pip install requests --upgrade
我将收到此作为输出:
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Requirement already up-to-date: requests in /usr/local/lib/python2.7/site-packages
所以,如果我发布一个简单的脚本:
#! usr/bin/python
import requests
printl("hello")
我收到此错误:
File "test.py", line 5, in <module>
import requests
ImportError: No module named requests
使用sys.path输出更新
[ '/usr/lib/python2.7/site-packages/simplejson-2.0.9-py2.7.egg', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages']
出了什么问题?
答案 0 :(得分:0)
我解决了这个问题。
如果有人遇到同样的问题,只需运行带有模块的python版本的脚本。
例如,在我的情况下,这有效:
$python2.7 test.py