问题
I have two versions of python on my mac:
One preinstalled by Apple in /usr/bin
One from python.org in /Library/Frameworks/Python.framework/Versions/2.6
easy_install always installs to /usr/bin
for some ununderstanable reason
So I explicitly now install easy_install in:
sh setuptools-0.6c11-py2.6.egg --install-dir=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Now I want to easy_install pip AND ....:
Searching for pip
Best match: pip 0.8
Processing pip-0.8-py2.6.egg
pip 0.8 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
error: /usr/local/bin/pip: Permission denied
My path and pythonpath:
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
export PATH
PYTHONPATH="/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages"
export PYTHONPATH
- One more PYTHONPATH where I keep modules I wrote
Sorry I really dont get it.
What am I doing wrong.
I just want to install modules regularly in the Framework Python directory
回答1:
It's hard to tell exactly what state your installation is in based on the information supplied. /usr/local/bin
is the default installation location for the Apple-supplied /usr/bin/easy_install
so, most likely, you are somehow invoking that instead of the easy_install
that should have been installed by running the sh setuptools...
script. There is no need to use the --install-dir
param to setuptools nor to set PYTHONPATH
to point to the framework site-packages directory; that happens automatically. And you should not modify the PATH
variable twice, just use the first PATH and export.
Starting from a newly-installed Python 2.6.5 from the python.org installer and a new terminal session, here's the whole sequence:
$ curl -O http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 325k 100 325k 0 0 125k 0 0:00:02 0:00:02 --:--:-- 136k
$ PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
$ export PATH
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.6/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
$ which python2.6
/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
$ python2.6 -c "import sys;print(sys.version_info)"
(2, 6, 5, 'final', 0)
$ sh setuptools-0.6c11-py2.6.egg
Processing setuptools-0.6c11-py2.6.egg
Copying setuptools-0.6c11-py2.6.egg to /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installing easy_install-2.6 script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installed /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
$ which easy_install
/Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install
$ easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://pip.openplans.org
Best match: pip 0.8
Downloading http://pypi.python.org/packages/source/p/pip/pip-0.8.tar.gz#md5=468d9adc309f33ad51cee38f0d455429
Processing pip-0.8.tar.gz
Running pip-0.8/setup.py -q bdist_egg --dist-dir /var/folders/Ux/UxzFPTCnF3esOnKQ1d3bbE+++TI/-Tmp-/easy_install-JU05mJ/pip-0.8/egg-dist-tmp-zwrzwI
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 0.8 to easy-install.pth file
Installing pip script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installing pip-2.6 script to /Library/Frameworks/Python.framework/Versions/2.6/bin
Installed /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-0.8-py2.6.egg
Processing dependencies for pip
Finished processing dependencies for pip
$ pip --version
pip 0.8 from /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pip-0.8-py2.6.egg (python 2.6)
回答2:
To uninstall django package.
First you have to run this command,
$ easy_install -m [PACKAGE]
This command will remove all dependencies of package. then remove egg file of that package.
$ rm -rf .../python2.X/site-packages/[PACKAGE].egg
来源:https://stackoverflow.com/questions/3582715/python-install-uninstall-easy-install