简体   繁体   English

在python中安装模块 - pip,distribute,nose,virtualenv

[英]installing modules in python - pip, distribute, nose, virtualenv

I'm aware that there are similar questions on SO. 我知道SO上也有类似的问题。 This one, for example: What's the proper way to install pip, virtualenv, and distribute for Python? 这个,例如: 为Python安装pip,virtualenv和分发的正确方法是什么?

I'd like to install these modules as per my Learn Python the Hard Way tutorial: http://learnpythonthehardway.org/book/ex46.html 我想根据我的Learn Python the Hard Way教程安装这些模块: http//learnpythonthehardway.org/book/ex46.html

I managed (I think) to install pip by using sudo easy_install pip but when I then ran pydoc modules I could not see it. 我管理(我认为)使用sudo easy_install pip安装pip,但是当我运行pydoc modules我看不到它。 So I'm not even sure it's installed. 所以我甚至不确定它是否已安装。

The answer above in question 4324558 is difficult for me to understand: what's a bootstrap, what's curl and why would I set up a virtual environment? 问题4324558上面的答案对我来说很难理解:什么是引导程序,什么是卷曲以及为什么我要设置虚拟环境? Yes, as a learner I should try to pick up as much as I can but I don't want to first create the universe, I just want to get the task at hand done. 是的,作为一个学习者,我应该尽可能多地尝试,但我不想先创建宇宙,我只是想完成手头的任务。

How do I install these modules? 如何安装这些模块? Is it as complicated as it sounds in the quoted answer? 是否像引用的答案中听起来那么复杂? The top voted answer says "Install virtualenv into a bootstrap virtual environment. Use the that virtual environment to create more. Since virtualenv ships with pip and distribute, you get everything from one install." 最高投票的回答是“将virtualenv安装到一个引导虚拟环境中。使用该虚拟环境创建更多。由于virtualenv带有pip和分发,你可以从一次安装中获得所有东西。”

I really don't get what all that means. 我真的不明白这一切意味着什么。 Isn't there something about the "Zen" of python and a one true way to get things done? 是不是有关于蟒蛇的“禅”和一个真正的方法来完成任务? Or am I out of context here? 或者我在这里脱离了背景? What is "the right way" to install these modules? 安装这些模块的“正确方法”是什么?

I tried: pip install virtualenv in the terminal and received the following output: 我试过:在终端上pip install virtualenv并收到以下输出:

Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Storing debug log for failure in /Users/myname/.pip/pip.log

I'm using a Mac and python 2.7 我正在使用Mac和python 2.7

To solve your issue, 为了解决你的问题,

Just install (or upgrade) the setuptools: 只需安装(或升级)setuptools:

sudo easy_install -U setuptools

Then you can run again: pip install virtualenv 然后你可以再次运行: pip install virtualenv

Try adding 'sudo' in your command as- 尝试在命令中添加“sudo” -

sudo pip install virtualenv

It worked for me. 它对我有用。

Have a look at Python Development Environment on Mac OS X Mavericks 10.9 . 在Mac OS X Mavericks 10.9上查看Python开发环境

I followed these steps as well when trying to get Python 2.7 and Python 3.3 installed on OS X. It doesn't tell you how to install nose and distribute, but you should have a working environment and you can pick up from there. 当我尝试在OS X上安装Python 2.7和Python 3.3时,我也遵循了这些步骤。它没有告诉你如何安装鼻子和分发,但你应该有一个工作环境,你可以从那里拿起。

I did have a problem using virtualenv and pip with Python 3, the question and solutions is available here . 我确实使用virtualenv和pip与Python 3有问题,问题和解决方案在这里可用。

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

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