[英]Python script works on Mac not on Ubuntu
I have a python script that works on Mac and not on Ubuntu. 我有一个在Mac上而不是Ubuntu上运行的python脚本。 When I run it in Ubuntu, I get the following error:
在Ubuntu中运行它时,出现以下错误:
Traceback (most recent call last):
File "deploy.py", line 15, in <module>
from modules.ima_python_utils import *
ImportError: No module named modules.ima_python_utils
It works on Mac, I don't know what's wrong. 它可以在Mac上运行,我不知道怎么了。
Ubuntu python version Ubuntu Python版本
python 2.7.3 python 2.7.3
Mac python version Mac python版本
python 2.7.10 python 2.7.10
Here's my structure: 这是我的结构:
__init__.py
deploy.py deploy.py
import sys
import getopt
import os
import parser
import distutils.dir_util
import json
import subprocess
import ConfigParser
from modules.ima_python_utils import *
__init__.py
__all__ = ["copy", "file", "folder", "database"]
I needed to have an __init__.py
inside the modules folder as well. 我还需要在modules文件夹中有一个
__init__.py
。 I don't know why it was working on OS X but who knows. 我不知道为什么它可以在OS X上运行,但是谁知道呢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.