如何撤消Python setuptools-前缀路径错误 [英] How to undo a Python setuptools --prefix path blunder

查看:115
本文介绍了如何撤消Python setuptools-前缀路径错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我安装Python的 setuptools 时,我心不在ed地使用了--prefix路径曾经在另一台机器上使用过:

When I installed Python's setuptools I absent mindedly tacked on a --prefix path I had been using on another machine:

sh setuptools-0.6c11-py2.7.egg --prefix=/opt/python2.7.2

现在在尝试安装pip时出现此错误之后,出现以下错误:

Now after this blunder when I try to install pip I get the following error:


[root@kkdev src]# easy_install pip
Searching for pip
Best match: pip 1.0.2
Processing pip-1.0.2-py2.7.egg
pip 1.0.2 is already the active version in easy-install.pth
Installing pip script to /usr/bin
error: /usr/bin/pip: No such file or directory

正在发生的是,正在创建一个符号链接,该符号链接指向我在--prefix路径中指定的文件夹:

What's happening is that a symbolic link is being created that points to the folder I specified in the --prefix path:


[root@kkdev src]# ls -al /usr/bin/pip
lrwxrwxrwx 1 root root 24 Nov  5 17:01 /usr/bin/pip -> /opt/python2.7.2/bin/pip

我删除了此链接,然后重新运行setuptools安装程序并指定了正确的前缀(我的Python安装位于/usr/lib/python2.7中):

I deleted this link and then re-ran the setuptools installer and specified the correct prefix (my Python install lives in /usr/lib/python2.7):


sh setuptools-0.6c11-py2.7.egg --prefix=/usr

然后我重新运行easy_install pip,看起来好像已经解决了手指问题.但是,当我去安装virtualenv时,遇到了同样的问题:

I then re-ran easy_install pip and it looked like I'd fixed my finger trouble. However when I went to install virtualenv I encountered the same problem:


[root@kkdev src]# pip install virtualenv

[uninteresting installer dialogue snipped]

Installing virtualenv script to /usr/bin

error: /usr/bin/virtualenv: No such file or directory

再次使用错误的路径创建指向安装virtualenv的符号链接:

Again the wrong path is being used to create the symbolic link to where virtualenv is installed:


[root@kkdev src]# ls -al /usr/bin/virtualenv
lrwxrwxrwx 1 root root 31 Nov  5 17:01 /usr/bin/virtualenv -> /opt/python2.7.2/bin/virtualenv

(我正在运行开箱即用的Python 2.7.1的Fedora 15 32位)

(I'm running Fedora 15 32bit which has Python 2.7.1 installed out of the box)

如何永久解决此问题?

推荐答案

我通过使用蛮力并从我的site-packages文件夹.

I managed to get back to square one by using brute force and eradicating any and all evidence of setuptools, easy_install and pip from my site-packages folder.

此后,我重新运行了sh setuptools-0.6c11-py2.7.egg 而没有 --prefix开关,一切恢复了原状.

After that I re-ran sh setuptools-0.6c11-py2.7.egg without the --prefix switch and things are as they should be now.

这篇关于如何撤消Python setuptools-前缀路径错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆