简体   繁体   中英

Python/Apache/Server - Can't import modules

I have a executable python script that I want to run using apache. A simple print('hello') works fine, however it fails if the script imports some package. In this case it fails at 'import pandas'.

I'm using python version 3.5.2

I have installed pandas with pip3 install pandas, and the installation is successful. If I try again, I get: Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.5.0->pandas) (1.10.0)

I have tried to start the script with both #! /usr/bin/python and #! /usr/bin/env python

Why could it be that it doesn't work? Is there some sort of step by step guide to manage this?

These two optiones worked for me: sudo apt-get install python3-pandas

or

sudo -H python3 -m pip install pandas

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