gpt4 book ai didi

Python 安装卸载 easy_install

转载 作者:太空狗 更新时间:2023-10-29 21:38:22 26 4
gpt4 key购买 nike

我的 mac 上有两个版本的 python:

Apple 预装在 /usr/bin

来自 python.org 的 /Library/Frameworks/Python.framework/Versions/2.6

easy_install 总是安装到 /usr/bin 出于某些不可理解的原因

所以我现在明确地将 easy_install 安装在:

sh setuptools-0.6c11-py2.6.egg --install-dir=/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

现在我想 easy_install pip 和 ....:

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

我的路径和python路径:

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
  • 还有一个 PYTHONPATH,我在其中保存我编写的模块

对不起,我真的不明白。

我做错了什么。

我只想在Framework Python目录下定期安装模块

最佳答案

根据提供的信息很难准确判断您的安装处于什么状态。 /usr/local/bin 是 Apple 提供的 /usr/bin/easy_install 的默认安装位置,因此,很可能您以某种方式调用它而不是 easy_install 应该通过运行 sh setuptools... 脚本安装。无需将 --install-dir 参数用于设置工具,也无需将 PYTHONPATH 设置为指向框架站点包目录;那是自动发生的。并且您不应该修改 PATH 变量两次,只需使用第一个 PATH 并导出即可。

从 python.org 安装程序新安装的 Python 2.6.5 和一个新的终端 session 开始,这是整个序列:

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

关于Python 安装卸载 easy_install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3582715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com