Python:ImportError:即使在执行pip安装后也没有名为xxx的模块

时间:2018-03-09 00:55:19

标签: python python-2.7

我正在安装项目https://github.com/wavefrontHQ/python-client并对其进行测试:

edamame$ pip install wavefront_client
Requirement already satisfied: wavefront_client in /usr/local/lib/python2.7/site-packages
Requirement already satisfied: urllib3>=1.15 in /usr/local/lib/python2.7/site-packages (from wavefront_client)
Requirement already satisfied: six>=1.10 in /usr/local/lib/python2.7/site-packages (from wavefront_client)
Requirement already satisfied: certifi in /usr/local/lib/python2.7/site-packages (from wavefront_client)
Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/site-packages (from wavefront_client)

这是我的test.py

import wavefront_api_client
import path.to.wavefront_api_client
import wavefront_api_client as wave_api

base_url = 'https://YOUR_INSTANCE.wavefront.com'
api_key = 'YOUR_API_TOKEN'

config = wave_api.Configuration()
config.host = base_url
client = wave_api.ApiClient(configuration=config, header_name='Authorization', header_value='Bearer ' + api_key)

# instantiate source API
source_api = wave_api.SourceApi(client)
sources = source_api.get_all_source()
print sources

但是我得到了错误:

edameme$ python test.py
    Traceback (most recent call last):
      File "test.py", line 1, in <module>
        import wavefront_api_client
    ImportError: No module named wavefront_api_client

如果我在文件的开头做了sys.print,我得到了:

我得到了:['/Users/edamame/Documents/git/python_wave', '/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Python/2.7/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']

为什么即使我已经安装了wavefront_api_client,我也会收到此错误?谢谢!

0 个答案:

没有答案