安装 Django 和 Python Suds(没有管理员权限)
我正在尝试设置使用以下内容的项目环境:
- Python 2.5.2
- Django 1.3
- Python Suds
我运行它的服务器已经安装了 Python (2.5.2) 和 Django (1.1),但我想使用更新的版本Django 的并且没有管理员权限来升级。我该如何再次安装这个?
我应该在单独的目录中安装 Python + Django + Suds 吗?我如何将标准 python 路径替换为这个新路径?
谢谢!
I am trying to setup my project environment which uses the following:
- Python 2.5.2
- Django 1.3
- Python Suds
The server I am running it on already has Python (2.5.2) and Django (1.1) installed but I want to use a newer version of Django and dont have administrator rights to upgrade. How do I go about installing this again?
Should I have to install Python + Django + Suds in a seperate directory? How would I replace standard python paths to this new one?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以使用 virtual_env,我曾经玩过另一个(不相关的)python 框架 buildbot
You can use virtual_env, I have used to play with another (unrelated) python framework buildbot
我会将 Django + Suds 安装在新目录中!那么您就可以向该目录中的每个人授予访问权限!那么如果您正在运行 apache,您只需将这个新文件夹添加到 PYTHONPATH 即可!
只是为了记录,我从未尝试过,但它应该有效!
也尝试在 google 中搜索 PYTHONPATH,这里有一个可能有帮助的链接:
http://www.stereoplex.com/blog/understand-imports-and-pythonpath干杯
I would install it Django + Suds in a new directory! then you can grant access to everyone in this dir! then If you are running apache you just have to add this new folder to PYTHONPATH!
Just for record, I have never tried that, but it should work!
try searching about PYTHONPATH in google too, here is one link that might help:
http://www.stereoplex.com/blog/understanding-imports-and-pythonpath
cheers
在其他路径中设置 django 的完整指南
通过 pip 安装 django
很多人使用 pip 包管理器来进行安装(不是我最喜欢的)。
要通过 pip 安装 django,您需要执行以下操作:
它将在非 root 用户无法访问的路径中安装 django。
所以你必须先添加它的安装位置。
此
$SOME_PLACE_WE_HAVE_ACCESS_TO
可以是/home/user/
目录。现在登录 python 并执行导入:
我们做错了什么???
PYTHONPATH
以及只要你没有在 PYTHONPATH 中安装 django python 就不知道在哪里导入模块!
执行以下两个步骤:
sys.path 显示了 python 中安装的包位置的路径。
并且 $PYTHONPATH 为空...
您唯一要做的就是将 django Egg 文件的路径添加到 PYTHONPATH
例如我的:
/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg
要将其添加到 PYTHONPATH 中,请执行以下操作:
导出 PYTHONPATH={{EGG PATH}}
其中 {{EGG PATH}} 是您的 django Egg 的位置。
django-admin 怎么样?
那么你必须从 django 设置它的地方运行它,它被安装在名为
bin
的地方为此,您可以将该 bin 的路径(认为可能是 ~/bin 或 any_place_you_installed/bin)添加到 $PATH...
就像 PYTHONPATH 一样:
注意 >> : $PATH 之后是必不可少的!!!知道为什么这样做:
echo $PATH
注意 >> ~/bin 必须是 django bin 目录,所以要注意这一点。
通过源安装 django
哦天哪,这是我的最爱。
与上面的东西没有什么区别,只是安装了 pip use setup.py...
因为你必须安装 setuptools... (我认为 pip 会自行安装,如果 pip 引发 setuptools 错误,你必须完成我的全部操作那里也告诉了 django for setuptools。)
安装 setuptools 后,您必须执行此操作:
其余部分相同...
参考
1 :通过 pip 在其他环境中安装包地点。
2:如何将 PATH 添加到 $PATH 。
A Complete Guide To setup django in other path
Installing django through pip
Well many use pip package manager for their install purpose (not my favorite).
to install django through pip you do something like:
it will install django in a path which is not accessible by non-root users.
So you must first add the installation place for it.
This
$SOME_PLACE_WE_HAVE_ACCESS_TO
can be/home/user/
directory.now login to python and do the import:
What are we doing wrong????
PYTHONPATH
well as long as you have not installed django in PYTHONPATH python doesn't know where to import the module!!!
do this two steps:
well sys.path show the path of packages locations installed in python.
and $PYTHONPATH is empty...
The only thing you have to do is to add the path of django egg file to PYTHONPATH
for example in mine its:
/usr/local/lib/python2.7/dist-packages/Django-1.9-py2.7.egg
to add it to PYTHONPATH do this:
export PYTHONPATH={{EGG PATH}}
which {{EGG PATH}} is the location of your django egg.
WHAT ABOUT django-admin?
well you have to run it from the place that django has set it up in somewhere it has been installed called
bin
for that you can add the path of that bin (Think it might be ~/bin or any_place_you_installed/bin) to $PATH...
just like PYTHONPATH we do:
ATTENTION >> : after $PATH is essential!!! to know why do a:
echo $PATH
ATTENTION >> ~/bin must be django bin directory so pay attention to that.
Installing django through source
OH My god That's my favorite.
there is nothing difference with the thing up there just insted pip use setup.py...
for that you must have setuptools installed... (I think pip will install that itself if pip raises error for setuptools you must do the whole thing I told up there for django for setuptools too.)
after you installed setuptools you must do this:
the rest is the same...
REFERENCES
1 : Installing package through pip in other location.
2 : How to add a PATH To $PATH.