简体   繁体   中英

Shared Server: Python Script run under UNIX Shell vs HTTP

I have a Python script on my Dreamhost shared server. When I access my script via SSH (using the UNIX Shell) my script executes fine and is able to import the Pycrypto module Crypto.Cipher .

But if I access my script via HTTP using my websites url. The script fails when it goes to import the Pycrypto module Crypto.Cipher . It gives the error ImportError: No module named Crypto.Cipher .

Do you know what might be causing this weird error? And how I can fix it.

Some important information:
- I have installed a custom version of python on my shared server. Its just Python 2.7 with Pycrypto and easy_install installed.
- I am certain that the script is running under Python 2.7 and not Dreamhosts default 2.6 version. I know this because the script prints sys.version_info(major=2, minor=7, micro=0, releaselevel='final', serial=0) both in the UNIX shell and HTTP.
- I installed Pycrypto manually (using tar, and running setup.py) as opposed to using easy_install or pip.
- I have editted my .bash_profile's PATH variable correctly (well I believe I have done it correctly because the script is run under Python 2.7 not 2.6).

Any advice would be extremely helpful.

您的Web服务器未读取.bash_profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM