简体   繁体   English

为python3.3安装pip

[英]Installing pip for python3.3

I downloaded pip from Package Index > pip 1.2.1 我从Package Index> pip 1.2.1下载了pip

Then I installed it using 然后我用它安装它

sudo python3.3 setup.py install

Still, when I try to use pip-3.3 the terminal complains 不过,当我尝试使用pip-3.3终端抱怨

-bash: pip-3.3: command not found

However, pip-2.7 works swimmingly. 然而, pip-2.7游泳。

I have also tried 我也试过了

curl -O http://python-distribute.org/distribute_setup.py
sudo python3.3 distribute_setup.py
sudo python3.3 -m easy_install pip

But pip-3.3 still does not work. 但是pip-3.3仍然不起作用。

What do I do to install pip for Python 3.3? 如何为Python 3.3安装pip?

Note that there is a related thread How to install pip with Python 3? 请注意,有一个相关的线程如何使用Python 3安装pip? , but the answer is just "Install distribute ... and then use that to install pip" which is not helpful to me because I have tried it and it did not work. ,但答案只是“安装分发...然后使用它来安装pip”,这对我没有帮助,因为我已经尝试过它并没有用。

Chances are that pip did get installed successfully somewhere . 有可能pip确实在某处成功安装。 However, somewhere is probably not on your PATH and so you shell (bash) doesn't know where to find it. 但是, 某个地方可能不在你的PATH ,所以你的shell(bash)不知道在哪里找到它。 For me, pip-2.6 is installed in: 对我来说, pip-2.6安装在:

/Library/Frameworks/Python.framework/Versions/2.6/bin/

It is probably a similar path for you (only 3.3 instead of 2.6). 它可能是一个类似的路径(只有3.3而不是2.6)。 Of course, adding to PATH is shell dependent. 当然,添加到PATH是依赖于shell的。 On bash-like shells you'd use export and on csh-like shells you'd use setenv -- And for convenience, you'd probably want to make the change in your shell's initialization file (eg ~/.bashrc or ~/.bash_profile or something similar). 在类似bash的shell上,你可以使用export和类似csh的shell,你可以使用setenv - 为了方便起见,你可能想在shell的初始化文件中进行更改(例如~/.bashrc~/.bash_profile或类似的东西)。

One way to go is to use the homebrew install for python3. 一种方法是使用python3的自制软件安装。 It comes with pip3 builtin. 它配备了pip3内置功能。 It also means you have an uninstaller unlike the dmg/pkg install. 这也意味着你有一个卸载程序,不像dmg / pkg安装。

If you have homebrew already its as easy as brew install python3 . 如果你已经自制了它就像brew install python3一样简单。 More detailed instructions here . 这里有更详细的说明。 And you can read more about the python3 brew install here . 你可以在这里阅读更多关于python3 brew安装的信息

For Mac: 对于Mac:

sudo easy_install pip3

If you still run into trouble, possibly because you compiled python3 yourself, use apt-get or homebrew to uninstall your compilation and reinstall the python3 package, at which point it should come with pip. 如果你仍然遇到麻烦,可能是因为你自己编译python3,使用apt-get或homebrew卸载你的编译并重新安装python3包,此时它应该带有pip。

brew uninstall python3
brew install python3
brew link --overwrite python3
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | sudo python3.3

看到这里

如果实际安装了pip,它总是可以通过版本化的Python命令调用,如下所示:

python3.3 -m pip

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

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