我对Linux上的python模块“请求”有问题。我在这个linux服务器上安装了python3.6。Unix管理员确认该服务器上已经安装了requets模块。这就是我如何检查模块是否已经安装。我可以看到请求模块的存在。
$ source /opt/rh/rh-python36/enable
$ pip show request
Name: request
Version: 1.0.2
Summary: http REQUEST (GET+POST) dict
Home-page: https://github.com/looking-for-a-job/request.py
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: /opt/rh/rh-python36/root/usr/lib/python3.6/site-packages
Requires: get, post, setuptools
Required-by:但是,当我尝试运行python代码时,仍然会遇到这个错误。
import requests
ModuleNotFoundError: No module named 'requests'我在这里错过了什么?有什么帮助吗?
发布于 2018-11-08 21:22:41
如果/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages没有在sys.path中显示,那么您有几个选项。
site-packages目录中安装显示在sys.path中的包。可以使用pip install --target=/somewhere/else package_name更改安装位置。site-packages目录,该目录显示在sys.path中。sys.path,将目录添加到您的sys.path.insert(0, '/opt/rh/rh-python36/root/usr/lib/python3.6/site-packages')中。https://stackoverflow.com/questions/53216070
复制相似问题