简体   繁体   English

如何安装virtualenv和/或pip

[英]how to install virtualenv and/or pip

Someone please tell me I'm not crazy, becuase I really feel like I am right now. 有人请告诉我,我不是疯了,因为我真的觉得我现在就是这样。

Ok so, I'm trying to setup a webapp with python and django using heroku, but I've hit quite an odd obstacle. 好吧,我正在尝试使用heroku设置一个使用python和django的webapp,但是我遇到了一个非常奇怪的障碍。

It wants me to setup a virtualenv using the command $ virtualenv venv --distribute , which is all well and good except: 它希望我使用命令$ virtualenv venv --distribute设置virtualenv ,这一切都很好,除了:

在此输入图像描述

yeh, so naturally I googled how to install virtualenv and I found this: 是的,所以很自然地我用Google搜索如何安装virtualenv,我发现了这个:

在此输入图像描述

But, of course: 但是当然:

在此输入图像描述

So I continued my search by trying to find out how to install pip and I found this: 所以我继续搜索,试图找出如何安装pip,我发现了这个:

在此输入图像描述

Aaaaaaand that's when I completely lost my marbles because apparently you need to install pip to install virtualenv to install pip. Aaaaaaand那时我完全丢失了弹珠,因为显然你需要安装pip来安装virtualenv来安装pip。 (maybe not, but that's why I'm a noob and I need help). (也许不是,但这就是为什么我是一个菜鸟,我需要帮助)。

But then I took another look at the vitualenv installation guide, and found that I could download it and install it manually, so I extracted all the files from the downloaded archive into my python33 folder and used setup.py install . 但后来又看了一下vitualenv安装指南,发现我可以下载并手动安装,所以我将下载的存档中的所有文件解压缩到我的python33文件夹中并使用setup.py install And I got this: 我得到了这个:

在此输入图像描述

So I changed the line in that file to except ValueError as e and I got another error from a different python file in that same folder so I reverted the change I made and decided that it probably was not a good idea to meddle with those scripts. 所以我将该文件中的行更改为except ValueError as e ,我从同一文件夹中的另一个python文件中得到了另一个错误,所以我还原了我所做的更改,并认为干涉这些脚本可能不是一个好主意。

Please, any help at all to do with setting up a free server with python and django would be greatly appreciated. 请与任何有关设置免费服务器与python和django的任何帮助将不胜感激。 Furthermore, I am sorry if my question is stupid, or incorrectly tagged. 此外,如果我的问题很愚蠢或标记错误,我很抱歉。

You are following install guides for linux. 您正在关注Linux的安装指南。 You should try to find an install guide for pip and virtualenv on windows. 您应该尝试在Windows上找到pip和virtualenv的安装指南。 First install pip systemwide and then use pip to install virtualenv systemwide. 首先在系统范围内安装pip,然后使用pip在系统范围内安装virtualenv。 Then start using virtual environments. 然后开始使用虚拟环境。

Start with How to install pip on W$ and Python and virtualenv on W$ . 如何在W $上安装pip开始, 在W $上安装 和virtualenv An alternative is the Hitchhiker's guide to python . 另一种选择是Hitchhiker的python指南

Edit 编辑

As Ron Elliott states in the comments, 正如Ron Elliott在评论中所述,

you'll need to point your path to C:\\Python2x\\Scripts or C:\\Python3x\\Scripts in order to pick up easy_install and pip as well as any other script executables installing to that directory. 你需要指向C:\\ Python2x \\ Scripts或C:\\ Python3x \\ Scripts的路径,以便选择easy_install和pip以及安装到该目录的任何其他脚本可执行文件。

But then I took another look at the vitualenv installation guide, and found that I could download it and install it manually, so I extracted all the files from the downloaded archive into my python33 folder and used setup.py install. 但后来又看了一下vitualenv安装指南,发现我可以下载并手动安装,所以我将下载的存档中的所有文件解压缩到我的python33文件夹中并使用setup.py install。

You downloaded the package and run setup.py install in wrong folder, that's why it didn't work. 您下载了该软件包并在错误的文件夹中运行setup.py install,这就是它无效的原因。

You should: 你应该:

  • Download the archive virtualenv-1.10.tar.gz to a Downloads folder (or where ever you want) archiveualenv-1.10.tar.gz存档下载到Downloads文件夹(或任何你想要的地方)
  • Extract it, you will have a folder name virtualenv-1.10 提取它,你将有一个文件夹名称virtualenv-1.10
  • Go to ( cd ) the extracted folder 转到( cd )提取的文件夹
  • Run command: python setup.py install 运行命令: python setup.py install

Anyway I would recommend installing setuptools and pip first, then you can install virtualenv from pip : pip install virtualenv . 无论如何,我会建议安装的setuptools点子第一,那么你可以安装virtualenvpippip install virtualenv

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

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