bash linux redhat 6 并安装easy_install

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19134782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 08:08:01  来源:igfitidea点击:

linux redhat 6 and installing easy_install

bashpython-2.7setuptoolseasy-install

提问by ggomersall

I'm completely new at this and needed a bit of help.

我对此完全陌生,需要一些帮助。

I've got a hosted server running Linux Redhat 6 and using Python 2.7 (which has just been set as the default from Python 2.6) located at /usr/local/bin/python2.7

我有一个运行 Linux Redhat 6 并使用 Python 2.7(刚刚从 Python 2.6 设置为默认值)的托管服务器,位于 /usr/local/bin/python2.7

I'm trying to setup easy_install on the server, but I'm not sure if i'm doing it correctly, on the bash screen i'm running: sudo apt-get install python-setuptools

我正在尝试在服务器上设置 easy_install,但我不确定我是否做得正确,在我正在运行的 bash 屏幕上:sudo apt-get install python-setuptools

But it keeps asking for a sudo password, which i'm assuming is my normal admin password that i've used to login via SSH? I've used my admin password and my root password which both don't seem to work, can any one help? Maybe it's an over sight from my side (being a newbie). Thanks Gareth

但它一直要求提供 sudo 密码,我假设这是我用来通过 SSH 登录的普通管理员密码?我使用了我的管理员密码和 root 密码,这两个密码似乎都不起作用,有人可以帮忙吗?也许这是我身边的视线(作为新手)。谢谢加雷斯

回答by Ewan

A couple of things:

几件事:

  1. Your sudopassword is likely the password for the user account on your server, however your user account may not have sudoaccess. Does the command provide any output?
  2. You're using RedHat however your apt-get installcommand is Debian/Ubuntu specific. The equivalent you are looking for is yum install
  3. However, yumuses Python 2.6 and any python package you install from the yumrepository will be installed for this version of python and not available to python 2.7.
  1. 您的sudo密码可能是您服务器上用户帐户的密码,但您的用户帐户可能没有sudo访问权限。该命令是否提供任何输出?
  2. 您使用的是 RedHat,但是您的apt-get install命令是特定于 Debian/Ubuntu 的。您正在寻找的等价物是yum install
  3. 但是yum使用 Python 2.6 并且您从yum存储库安装的任何 python 包都将为此版本的 python 安装,但不适用于 python 2.7。

To get around this you have a couple of options:

要解决这个问题,您有几个选择:

  1. Use something like pythonbrewwhich allows you to switch python interpreters on your system (you still wont be able to yum install python-setuptoolsbut allows you to easily switch between Python 2.6/2.7/3.3)
  2. Use the following command from the setuptoolswebsite wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | pythonto install as long as pythongives you python2.7
  3. After doing that, easy_install pipto get pipinstalled on your system (hopefully for python 2.7)
  4. Use virtualenv's - they get round all your sudoproblems.
  1. 使用类似的东西pythonbrew,它允许你在你的系统上切换 python 解释器(你仍然不能,yum install python-setuptools但允许你在 Python 2.6/2.7/3.3 之间轻松切换)
  2. 只要给你python2.7,使用setuptools网站下面的命令wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | python安装即可python
  3. 这样做之后,easy_install pip得到pip安装在系统上(希望为Python 2.7)
  4. 使用virtualenv's - 它们可以sudo解决您的所有问题。