使用virtualenv使用Python 3.4安装django1.7 [英] Install django1.7 with Python 3.4 using virtualenv

查看:87
本文介绍了使用virtualenv使用Python 3.4安装django1.7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经打了一个砖墙,关于使用配置为Python 3.4的virtualenv来设置django 1.7。

I have hit a bit of a brick wall regarding the set up of django 1.7 using a virtualenv configured to Python 3.4.

我已经创建了一个Python 3.4 virtualenv,使用:

I have created a Python 3.4 virtualenv using:

sudo virtualenv --no-site-packages -p /usr/bin/python3.4 venv

然后我使用以下方式激活了env:

I have then activated the env using:

source venv/bin/activate

一旦在激活的virtualenv我尝试过:

Once in the activated virtualenv i have tried:

sudo pip install https://www.djangoproject.com/download/1.7b1/tarball/

这将在Python 2.7目录中安装django,而不是在虚拟环境中。
使用点击冻结显示没有安装的软件包

This installs django in the Python 2.7 directory and not in the virtual environment.. Checking with pip freeze shows no installed packages

我已经尝试下载django 1.7的zip,并使用 python setup.py在环境中安装,但是仍然会在env和2.7目录之外发生安装。

I have tried downloading the zip for django 1.7 and using python setup.py install within the environment but still get the install occurring outside of the env and in the 2.7 directory..

任何关于我做错事的建议或指针都将非常感激!

Any advice or pointers on what i'm doing wrong would be really appreciated!!

推荐答案

sudo 在创建virtualenv时和在virtualenv中用pip进行安装时是不必要的。尝试以下代码:

sudo is unnecessary when creating a virtualenv and when installing with pip inside a virtualenv. Try the following instead:

$ virtualenv -p /usr/bin/python3.4 venv

$ source venv / bin / activate

(此时您可以检查您的virtualenv是否处于活动状态,并使用python 3.4与哪个python ,它应该打印像 / home / user / projects / venv / bin / python python --version ,应该打印Python 3.4.x)

(At this point, you can check that your virtualenv is active and using python 3.4 with which python, which should print something like /home/user/projects/venv/bin/python, and python --version, which should print Python 3.4.x)

$ pip install https://www.djangoproject.com/download/1.7b1/tarball/

这篇关于使用virtualenv使用Python 3.4安装django1.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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