python pip模块安装_找不到Python pip安装模块。如何将python链接到pip位置?

I'm a newbie and I needed the pySerial and feedparser module for my projects. I'm running Mountain lion.

I followed the following tutorial so that I could upgrade to python 2.7.3 and then use the above mentioned modules.

I followed this tutorial till I installed pip. Instead of installing Virtualenv. I used the following commands to install pySerial and feedparser

$ pip install pySerial

Requirement already satisfied (use --upgrade to upgrade): pySerial in /Library/Python/2.7/site-packages

Cleaning up...

I assumed that this was already present and checked it. Python seems to be importing this just fine. My python version has been upgraded to 2.7.3 btw since I installed it using homebrew as mentioned in the tutorial.

Then I tried installing feedparser

$ pip install feedparser

Requirement already satisfied (use --upgrade to upgrade): feedparser in /usr/local/lib/python2.7/site-packages

Cleaning up...

Notice how its in the site-packages directory in the usr/local/lib.

All of my pip installs are being installed in that directory but python does not seem to be picking them up when i try importing them.

How do I set the path so that python also looks there as well as core directory?

Your help will be greatly appreciated.

but niether of them are in the same situation as I am. I don't understand why this is happening as i edited my bash_profile with the following

# Set architecture flags

export ARCHFLAGS="-arch x86_64"

# Ensure user-installed binaries take precedence

export PATH=/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

# Load .bashrc if it exists

test -f ~/.bashrc && source ~/.bashrc

then installed homebrew and then installed python 2.7.3 through homebrew (2.7.3 is now currently running on my machine)

I figured all pip installs would be correctly linked?

解决方案

As a quick workaround, and assuming that you are on a bash-like terminal (Linux/OSX), you can try to export the PYTHONPATH environment variable:

export PYTHONPATH="${PYTHONPATH}:/usr/local/lib/python2.7/site-packages:/usr/lib/python2.7/site-packages"

For Python 2.7

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值