简体   繁体   English

Python安装卸载easy_install

[英]Python install uninstall easy_install

I have two versions of python on my mac: 我的mac上有两个版本的python:

One preinstalled by Apple in /usr/bin Apple在/usr/bin预安装的一个

One from python.org in /Library/Frameworks/Python.framework/Versions/2.6 一个来自/Library/Frameworks/Python.framework/Versions/2.6 python.org

easy_install always installs to /usr/bin for some ununderstanable reason easy_install总是安装到/usr/bin因为一些无法理解的原因

So I explicitly now install easy_install in: 所以我现在显式安装easy_install:

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 ....: 现在我想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: 我的路径和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 还有一个PYTHONPATH,我保留了我写的模块

Sorry I really dont get it. 对不起,我真的不明白。

What am I doing wrong. 我究竟做错了什么。

I just want to install modules regularly in the Framework Python directory 我只想在Framework Python目录中定期安装模块

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. /usr/local/bin是Apple提供的/usr/bin/easy_install的默认安装位置,所以,很有可能,你是以某种方式调用而不是应该通过运行sh setuptools...脚本安装的easy_install sh setuptools... There is no need to use the --install-dir param to setuptools nor to set PYTHONPATH to point to the framework site-packages directory; 不需要使用--install-dir param来设置工具,也不需要将PYTHONPATH设置为指向框架site-packages目录; that happens automatically. 这是自动发生的。 And you should not modify the PATH variable twice, just use the first PATH and export. 并且您不应该修改PATH变量两次,只需使用第一个PATH并导出。

Starting from a newly-installed Python 2.6.5 from the python.org installer and a new terminal session, here's the whole sequence: 从python.org安装程序中新安装的Python 2.6.5和新的终端会话开始,这是完整的序列:

$ 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)

To uninstall django package. 卸载django包。

First you have to run this command, 首先你必须运行这个命令,

$ easy_install -m [PACKAGE] $ easy_install -m [PACKAGE]

This command will remove all dependencies of package. 此命令将删除包的所有依赖项。 then remove egg file of that package. 然后删除该包的egg文件。

$ rm -rf .../python2.X/site-packages/[PACKAGE].egg $ rm -rf ... / python2.X / site-packages / [PACKAGE] .egg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM