如何使用 pip for django 为 virtualenv 项目安装图像处理

发布于 2024-11-30 22:11:00 字数 771 浏览 0 评论 0原文

但我正在寻找安装 freetype、libjpeg、PIL 构建以将图像处理添加到我的 django 项目中我遵循此安装 http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/ 它在整个网站上安装它,但我可以将它放在我的虚拟环境项目。

我是否只需 cd 进入 virtualenv (项目)的工作目录并将其安装在那里,它只能用于该项目还是使用 pip?我在 pip 存储库中找不到这些包。有人可以启发我吗?

curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz
tar -xzvf distribute-0.6.21.tar.gz
cd distribute-0.6.21
python distribute_setup.py
easy_install pip
pip install virtualenv
virtualenv --distribute --no-site-packages [myproject]
cd [myproject]
source bin/activate (this activates the sandbox that virtualenv created)
pip install django mysql-python

But I'm looking to install freetype, libjpeg, PIL build to add image processing to my django projects I've followed this installation http://dakrauth.com/blog/entry/python-and-django-setup-mac-os-x-leopard/ which installs it site wide but I can get it inside my virtualenv project.

Do I just cd into the working directory of the virtualenv (project) and install it there and will it just be available for that project or do I use pip? I couldn't find the packages in the pip repository. Can someone enlighten me please.

curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.21.tar.gz
tar -xzvf distribute-0.6.21.tar.gz
cd distribute-0.6.21
python distribute_setup.py
easy_install pip
pip install virtualenv
virtualenv --distribute --no-site-packages [myproject]
cd [myproject]
source bin/activate (this activates the sandbox that virtualenv created)
pip install django mysql-python

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷默言语 2024-12-07 22:11:00

转到 virtualenv 的工作目录,然后运行

$ source bin/activate

​​这将将该虚拟环境设置为您的活动环境。现在它已处于活动状态,您可以手动安装(按照您链接到的站点上的步骤)或使用 pip 安装所需的内容,它会自动将其安装到您的活动 virtualenv 中。

例如,如果您在同一个 virtualenv 处于活动状态时运行 python manage.py runserver ,则 django 将可以访问您新安装的包。一旦您想要将该虚拟环境取消设置为活动环境,只需停用即可。

Go to the working directory of the virtualenv and then run

$ source bin/activate

This will set that virtual environment as your active one. So now that it's active, you can install what you want, either manually (by following those steps on the site you linked to) or with pip and it will automatically install it into your active virtualenv.

If you then, say, run python manage.py runserver while the same virtualenv is active, django will have access to your newly installed package. Once you want to unset that virtual environment as your active one, simply do deactivate.

没有你我更好 2024-12-07 22:11:00

我遇到了类似的事情;我所做的是将其安装到默认目录(例如Python27/Lib/site-packages)中,然后将所有新文件剪切并粘贴到创建的环境的站点包中。哈克,但有效。

之后,您可以按照 EEVIAC 的说明来实际运行您的服务器。

I ran into something similar; what I did was install it into the default directory (e.g. Python27/Lib/site-packages) then cut and paste all the new files put there into the created environment's site-packages. Hacky, but works.

After that you can follow EEVIAC's instructions to actually get your server running.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文