Home >Backend Development >Python Tutorial >Full analysis of pydev deployment and development
When deploying an uploaded project developed by pydev to the test environment
1. It prompts that the module I wrote cannot be found
Solution: Add code to the project entrance
#Add the source directory to the PYTHONPATH of the project
PROJECT_DIR = os .path.dirname(__file__)
PROJECT_ROOT_DIR = os.path.dirname(PROJECT_DIR)
if not PROJECT_ROOT_DIR in sys.path:
sys.path.append(PROJECT_ROOT_DIR)
if not PROJECT_DIR in sys.path:
sys.path.append(PROJECT_DIR)
2. When running, the default encoding is ascii, not utf-8 error
Solution: Add sitecustomize.py in the site-packages directory of python
import sys
sys .setdefaultencoding("utf-8")
3. When easy_install installs PIL, it prompts that jpeg is not supported (png is similar)
Solution: Since centos is 64-bit, when yum install libjpeg*, it is installed to /usr/lib64 directory,
and the default search path of PIL is /usr/lib, so if it is not found and an error is reported, just do ln directly