【问题标题】:Error installing Tweepy for Python (Mac)安装 Tweepy for Python (Mac) 时出错
【发布时间】:2015-02-12 09:28:22
【问题描述】:

我正在使用 Python 2.6.6 并且一直在尝试下载 tweepy,但是每当我在 Python IDLE shell 中导入 tweepy 时,它都会返回“没有名为 tweepy 的模块”错误。

我已经用 tweepy 下载了

sudo pip install tweepy

它直接进入 /Library/Python/2.7/site-packages 没有问题。

然后我从那条路径 cd 到 tweepy 和

python setup.py install

但是这个错误信息出现了

/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python: can't open file 'python': [Errno 2] No such file or directory

我已经走过了这条路,最后用 Python 一切都是正确的。

但是,当我打开 Python IDLE shell 并

import tweepy 

出现“没有名为 tweepy 的模块”错误。

非常感谢任何帮助!

【问题讨论】:

    标签: python-2.7 pip tweepy


    【解决方案1】:

    pip 正在使用 Python 2.7,正如您可以从 site-packages 路径中看出的那样,而您显然正在尝试安装以与 2.6 一起使用。撇开为什么使用 2.6 的问题不谈,这个问题很容易解决 - 使用 Python 2.6 安装 pip

    下载get-pip.py,然后(假设你的python命令指向2.6版)运行:

    sudo python get-pip.py
    

    安装好之后就可以运行了

    sudo pip2.6 install tweepy
    

    一切都应该正常工作。

    【讨论】:

    • 我使用python 2.7 执行sudo pip install tweepy 时出现以下错误:OSError: [Errno 1] Operation not permitted: '/tmp/pip-CSR9pt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
    • @AditiNarware 首先,我强烈推荐使用 Python 3。其次,不要使用或修改系统 Python - 这是一个特殊的OS X 内部使用的版本,但可能会导致常规开发人员使用出现问题。从 MacPorts、Homebrew 或 python.org 安装 Python。然后,使用 virtualenvs 安装新包。
    猜你喜欢
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-31
    • 1970-01-01
    • 1970-01-01
    • 2013-05-10
    相关资源
    最近更新 更多