What is the Python egg cache (PYTHON_EGG_CACHE)?

后端 未结 8 604
我寻月下人不归
我寻月下人不归 2020-12-04 16:23

I\'ve just upgraded from Python 2.6.1 to 2.6.4 on my development machine and upon starting a python script was presented with the following message:

C

相关标签:
8条回答
  • 2020-12-04 16:57

    A simple fix would be to create the directory and provide www-data access to it.

    $ mkdir /var/www/.python-eggs
    $ chown www-data:www-data /var/www/.python-eggs
    
    0 讨论(0)
  • 2020-12-04 17:03

    From my investigations it turns out that some eggs are packaged as zip files, and are saved as such in Python's site-packages directory.

    These zipped eggs need to be unzipped before they can be executed, so are expanded into the PYTHON_EGG_CACHE directory which by default is ~/.python-eggs (located in the user's home directory). If this doesn't exist it causes problems when trying to run applications.

    There are a number of fixes:

    1. Create a .python-eggs directory in the user's home directory and make it writable for the user.
    2. Create a global directory for unzipping (eg. /tmp/python-eggs) and set the environment variable PYTHON_EGG_CACHE to this directory.
    3. Use the -Z switch when using easy_install to unzip the package when installing.
    0 讨论(0)
提交回复
热议问题