Python - 导入模块

时间:2015-08-05 16:24:13

标签: python mysql cgi

我的cgi-bin中有一个python脚本,它有效,它只是一个简单的hello world脚本。现在我想导入一些模块,比如MySqldb等,我把它们安装在python中,因为我可以从ssh(终端)运行脚本,但是我无法在cgi-bin中运行它。我收到一个错误,说明了这个

 /var/www/cgi-bin/build/bdist.linux-x86_64/egg/MySQLdb/__init__.py in ()
 /var/www/cgi-bin/build/bdist.linux-x86_64/egg/_mysql.py in ()
 /var/www/cgi-bin/build/bdist.linux-x86_64/egg/_mysql.py in __bootstrap__()
 /usr/lib/python2.7/site-packages/pkg_resources.py in resource_filename(self=<pkg_resources.ResourceManager instance>, package_or_requirement='_mysql', resource_name='_mysql.so')

这个

class '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: '/usr/share/httpd/.python-eggs' The Python egg cache directory is currently set to: /usr/share/httpd/.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. 
      args = ("Can't extract file(s) to egg cache\n\nThe followin...nt\nvariable to point to an accessible directory.\n",) 
      cache_path = '/usr/share/httpd/.python-eggs' 
      manager = <pkg_resources.ResourceManager instance> 
      message = "Can't extract file(s) to egg cache\n\nThe followin...nt\nvariable to point to an accessible directory.\n" 
      original_error = OSError(13, 'Permission denied')

那么如何在那里导入/安装模块?

由于

0 个答案:

没有答案