我在 php 调用 python 脚本时遇到问题,或者它调用脚本但在尝试导入 MySQLdb 时在某处停止
现在添加到我的用户 .bash_profile 之后,按照本指南如何修复开始出现与 PYTHON_EGG_CACHE 相关的错误的 Trac 安装?
export PYTHON_EGG_CACHE /var/www/html/path/cache
和 httpd.conf
AddHandler mod_python
SetEnv PYTHON_EGG_CACHE /var/www/html/path/cache
我仍然收到此错误消息,网络服务器仍在尝试访问 /root/.python-eggs 并且我无法在我的新文件夹中找到导出的 .python-eggs
Array
(
[stdout] =>
[stderr] => Traceback (most recent call last):
File "/var/www/html/grndb/upscgenesearch/python/pythontest.py", line 4, in ?
import MySQLdb
File "build/bdist.linux-x86_64/egg/MySQLdb/__init__.py", line 19, in ?
File "build/bdist.linux-x86_64/egg/_mysql.py", line 7, in ?
File "build/bdist.linux-x86_64/egg/_mysql.py", line 4, in __bootstrap__
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 799, in resource_filename
return get_provider(package_or_requirement).get_resource_filename(
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1229, in get_resource_filename
return self._extract_resource(manager, zip_path)
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1249, in _extract_resource
real_path = manager.get_cache_path(
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 880, in get_cache_path
self.extraction_error()
File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 846, in extraction_error
raise err
pkg_resources.ExtractionError: Can't extract file(s) to egg cache
尝试将文件提取到 Python egg 缓存时发生以下错误:
[Errno 13] Permission denied: '/root/.python-eggs'
Python egg 缓存目录当前设置为:
/root/.python-eggs
也许您的帐户没有对该目录的写入权限?您可以通过将 PYTHON_EGG_CACHE 环境变量设置为指向可访问目录来更改缓存目录。