python可执行文件无法正常工作

时间:2016-03-24 21:50:50

标签: python tweepy

我编写了一个python脚本,使用tweepy模块实时存储推文。脚本运行正常。

然后我尝试通过添加#!/usr/bin/python然后在终端上运行chmod +x stream_tweets.py命令来使脚本可执行。现在,如果我使用python stream_tweets.py运行脚本,脚本运行正常,但使用./stream_tweets.py运行它会显示一个错误,即没有名为tweepy的模块!

enter image description here

我认为它可能与环境变量有关,但我对这些并不太了解。任何人都可以解决这个问题吗?

2 个答案:

答案 0 :(得分:2)

而不是#!/usr/bin/python使用which python所说的内容,或#!/usr/bin/env python

答案 1 :(得分:0)

安装tweepy,如上所述here