获取“No module named oauth2”的错误
问题描述:
我试图运行一个python工具来验证我对linkedin的访问,以便我下载我的linkedin网络,以便我可以在Gephi中分析它。我在这里得到这样的文件:获取“No module named oauth2”的错误
linkedin-1-oauth.py from github
我克隆是和他在主旨其他两个文件。我通过为所有3个文件执行git clone [url here]
而从我的终端执行此操作。我把我的api和密钥放在相应的地方。
我做了pip install oauth2
和更新的建议在这里:
pip install oauth2 and update httplib2
我也没有这个命令行,其下载并安装的文件在同一目录的地方,我下载了LinkedIn来自gist的文件,只是在我的用户文件夹中。
当试图pip install oauth2
并得到以下错误消息:
Downloading/unpacking oauth2
Running setup.py egg_info for package oauth2
Requirement already satisfied (use --upgrade to upgrade): httplib2 in /usr/lib/python2.7/dist-packages (from oauth2)
Installing collected packages: oauth2
Running setup.py install for oauth2
error: could not create '/usr/local/lib/python2.7/dist-packages/oauth2': Permission denied
Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/steven/build/oauth2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-e2RkcV-record/install-record.txt:
running install
running build
running build_py
running install_lib
creating /usr/local/lib/python2.7/dist-packages/oauth2
error: could not create '/usr/local/lib/python2.7/dist-packages/oauth2': Permission denied
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/steven/build/oauth2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-e2RkcV-record/install-record.txt failed with error code 1
Storing complete log in /home/steven/.pip/pip.log
我又试图easy_install oauth2
并得到了以下错误消息:
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-4349.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://packages.python.org/distribute/easy_install.html
Please make the appropriate changes for your system and try again.
于是我试着做sudo apt-get install oauth2
,它不能找到
我运行Ubuntu 12.04 LTS我做了所有我的sudo更新和升级之前,我做了其他事情今天早上。我正在运行的Python 2.7
谢谢
答
步骤在Windows安装python的oauth2库
- 下载http://python-distribute.org/distribute_setup.py并复制到安装python的地方
- 运行“python distribute_setup.py“
- 将Oauth2下载并解压缩到目录。导航到此目录。
- 运行“蟒蛇的setup.py安装”,安装ouath2
答
,如果你有蟒蛇2.7.10或更高这里是更简单的方法。 使用'点'来安装python模块。 在我的情况下,在windows下说一些技巧。 C:\ Python27 \ Scripts \ pip install ouath2