Pylons  - 讨论区

标题:转:【翻译】The Definitive Guide to Pylons(十一)

2010年10月22日 星期五 17:07

Troubleshooting EasyInstall
EasyInstall疑难解答

On rare occasions, the Python Package Index goes down but is still possible to install Pylons and its dependencies in these circumstances by specifying Pylons' local package directory for installation instead. You can do so like this:

在罕见的情况下,PyPI不能使用,但在这种情况下,仍然有可能安装Pylons及其依赖,通过指定Pylons的本地包安装目录来代替。你可以这样做:

$ easy_install -f  http://pylonshq.com/download/  Pylons

This command tells EasyInstall to first check the Pylons website before going to PyPI. If it finds links to everything it needs on the specified page, it won't have to go to PyPI at all.

此命令告诉EasyInstall,在PyPI之前,先检查Pylons网站。如果它在指定的网页发现需要的一切链接,它不会再去PyPI。


Note

If you're using an older version of Pylons, you can get the packages that went with it at the time it was released by specifying the version desired and the Pylons version-specific download site:

注意:  
如果你使用旧版的Pylons,你可以通过指定需要的版本和Pylons特定版本的下载站点,获取当时公布的软件包:

$ easy_install -f  http://pylonshq.com/download/0.9.2/  "Pylons==0.9.2"

The same technique can be used to install any of Pylons' dependencies too.
同样的技术也可以被用来安装Pylons的任何依赖。

 

If you can't connect to the internet at all you will need to install Pylons offline. Download all of Pylons' dependencies and place them in a directory called downloads then use EasyInstall to install the software from the directory using this command:

如果你无法连接到互联网上,你需要离线安装Pylons。下载所有的Pylons依赖,并将它们放在同一个名为download的目录中,然后使用EasyInstall从该目录安装软件,使用此命令:

$ easy_install -f downloads/ Pylons

Occasionally EasyInstall fails to find a package it is looking for on the Python Package Index. If this situation occurs you should first ensure you have the latest version of setuptools by issuing this command (the -U flag means upgrade as we saw earlier):

偶尔EasyInstall未能找到一个包,它会到PyPI上寻找。如果发生这种情况,你应该首先确保你有最新版本的setuptools,通过此命令确认(-U表示升级,正如我们之前看到的) :

$ easy_install -U setuptools

You will need to do this in Ubuntu 7.04 for example if you obtained EasyInstall via the python-setuptools*.deb file rather than as part of your virtual Python environment set up because the version in the .deb file is too old for Pylons and its dependencies.

在Ubuntu 7.04你将需要这么做,例如,如果你通过python-setuptools*.deb文件获取EasyInstall,而不是作为Python的虚拟环境的一部分成立,因为.deb文件的版本对于Pylons及其依赖来说太旧了。

After upgrading, try to install Pylons again and if one of the dependencies still fails you will need to manually install that dependency first before attempting the Pylons installation once again.

升级后,再次尝试安装Pylons,如果一个依赖仍然安装失败,在试图再次安装Pylons前,你将需要首先手动安装这个依赖。

Another error message you may occasionally encounter when using EasyInstall is a pkg_resources.ExtractionError which reads:

另一个你可能偶尔会遇到的错误信息,使用EasyInstall时发生pkg_resources.ExtractionError内容如下:


Can't extract file(s) to egg cache The following error occurred while
trying to extract file(s) to the Python egg cache: [Errno 13] Permission
denied: '/var/www/.python-eggs' The Python egg cache directory is currently set
to: /var/www/.python-eggs Perhaps your account does not have write access to
this directory? You can change the cache directory by setting the
PYTHON_EGG_CACHE environment variable to point to an accessible directory.

不能提取的文件到egg缓存,当试图提取文件到Python egg缓存时,发生以下错误: [Errno 13]许可拒绝:'/var/www/.python-eggs',Python egg缓存目录目前设定为:/var/www/.python-eggs,也许你的帐户没有关于这个目录的写入权限?你可以更改缓存目录,设置PYTHON_EGG_CACHE环境变量指向可访问的目录。

 

As the error message suggests an egg containing a module being imported by pkg_resources (another module installed with setuptools and easy_install) needs its to have its contents extracted before the module can be used but the running script doesn't have permission to extract the egg to the default location. You can change the place the eggs are extracted to by setting the environment variable PYTHON_EGG_CACHE to somewhere the application has permission to write to. One way of doing this is as follows:

错误信息表明一个egg含有一个被pkg_resources导入的模块(另一个模块安装使用setuptools和easy_install),在模块可以使用之前,需要它提取它的内容,但运行脚本没有权限来提取egg到预设位置。你可以更改eggs提取到的地点,通过设置环境变量PYTHON_EGG_CACHE到某处,该位置应用程序有权限写入。一个办法如下:

import os
os.environ['PYTHON_EGG_CACHE'] = '/tmp'

You would need to add this line before the module import which is failing and you would usually use a more appropriate location than /tmp.

在之前导入失败的模块导入前,你将需要加入这一行,你通常会使用比/ tmp更合适的位置。

If you are still having problems you'll need to look online or contact the Pylons mailing list at  pylons-discuss@googlegroups.com . Two good places to start are the EasyInstall documentation at  http://peak.telecommunity.com/DevCenter/EasyInstall  and the TurboGears install troubleshooting guide at http://docs.turbogears.org/1.0/
InstallTroubleshooting. TurboGears 1.0 uses the same install system as Pylons so the problems encountered are often similar.

如果你仍遇到问题,你需要上网查阅,或联系Pylons邮件列表 pylons-discuss@googlegroups.com 。有两个很好的地方可以使用,一个是EasyInstall文档 http://peak.telecommunity.com/DevCenter/EasyInstall 和TurboGears安装故障排除指南 http://docs.turbogears.org/1.0/InstallTroubleshooting 。 TurboGears 1.0使用跟Pylons相同的安装系统,因此,遇到的问题往往是相似的。

 

原文: http://hi.baidu.com/zhuifengdenanhai/blog/item/bc55dfc899ab86107f3e6fb7.html

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2024

    京ICP备05028076号