正确的Tweepy API目录添加到PythonPath [英] Correct directory for Tweepy API to add to the PythonPath

查看:328
本文介绍了正确的Tweepy API目录添加到PythonPath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置iMac 10.7.4,Eclipse Indigo,Pydev,Python 2.7

Setup iMac 10.7.4, Eclipse Indigo, Pydev, Python 2.7

我正在尝试安装Tweepy API,但对于任何初学者来说,文档有点稀疏程序员。我以为我已经安装了,因为我已经将必要的文件下载到我的应用程序文件夹,并输入python setup.py install

I’m trying to install the Tweepy API but the documentation is a bit sparse for any beginner programmer. I thought I had it installed as I had downloaded the necessary file to my applications folder and typed 'python setup.py install'

但是,我只是在了解Pythonpath和正确的方式使用 import

However I’m only now learning about the Pythonpath and the correct way of using import

任何人都可以告诉我我应该找到Tweepy文件夹,以便我可以将其添加到PythonPath

Can anyone tell me where I should locate the Tweepy folder so that I can add it to the PythonPath

我的Python系统库都位于我认为是标准目录配置

My Python "System libs" are all located in what I believe is a standard directory configuration

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

编辑:PythonPath打印输出

PythonPath Printout

['/Users/me/Documents/workspace/Tweeter/src',

 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy-1.7.1-py2.7.egg',

'/Users/me/Documents/workspace/Tweeter/src', '
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy-1.7.1-py2.7.egg', 

'/Applications/eclipse/plugins/org.python.pydev_2.5.0.2012040618/PySrc/pydev_sitecustomize', 

'/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tweepy-1.7.1-py2.7.egg', '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip']


推荐答案

您可以在PYTHONPATH中的一个文件夹中。

You can place in a folder in your PYTHONPATH.

要知道您的PYTHONPATH中有哪些文件夹你可以运行这个python代码

To know which folders are in your PYTHONPATH you can run this python code

import sys
print sys.path

有时您还可以在当前工作目录中添加包。

Also sometimes you can also add packages in your current working directory.

或将它任何地方(大概你将不得不添加空文件__init__.py),然后在使用之前执行此操作。

OR put it anywhere (probably you will have to add empty file named __init__.py ) then do this before use,

import sys
sys.path.append('/absolute/path/to/your/tweepyparentdir')

这篇关于正确的Tweepy API目录添加到PythonPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆