安装完python怎么打开pip-如何在新的python安装中安装pip

1586010002-jmsa.png

I recently installed python 2.7.2 on my Mac running OSX 10.6.8. Previously, I had version 2.6. I set my path in .bash_profile as follows:

export PATH=/usr/local/bin:$PATH

export PATH=/usr/local/share/python:$PATH

so that when I run python it will refer to my new installation. It does.

I would also like to use pip with my new installation, but the problem is that I already have the current version of pip installed at

/usr/local/bin/pip.

I tried to re-install pip with:

easy_install pip

But, of course this does not put pip in the desired new directory

/usr/local/share/python/pip

but simply refers to the existing version in /usr/local/bin/pip.

Can someone tell me how to fix this?

I would like to then use pip to install NumPy and SciPy in the correct directory (I was having trouble getting the SciPy installation to work with my old version of python, hence the new install).

If you'd like, you can visit the website where I found instructions for installing python 2.7, creating/updating my .bash_profile, installing pip, and NumPy and SciPy. Might provide some insight, or I'm happy to give more details if needed. Thanks!

http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/#python

解决方案

Install distribute as per the instructions at http://pypi.python.org/pypi/distribute .

Make sure you specify the full path to the python executable (/usr/local/share/python/python or smth in your case).

$ curl -O https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py

$ /usr/local/share/python/python distribute_setup.py

Then you should have /usr/local/share/python/easy_install.

After that, run:

$ /usr/local/share/python/easy_install pip

Then you should have /usr/local/share/python/pip.

Depending on the ordering of things in your PATH, either your old, or the newly installed pip is executed when you execute the pip command, so you either might have to adapt your PATH, or specify the full path to /usr/local/share/python/pip when installing eggs.

(shameless plug:

In any case, you might consider using virtualenv for installing packages into a "project" specific isolated environment, as opposed to installing them globally.)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值