Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 cwd 中有一个 zmq 目录。当我从在 apache 下运行的 python 文件导入 zmq 时,它给了我导入错误。但是当我使用控制台从当前目录导入 zmq 时,它会导入。
如何从我的服务器中的任何地方进行此导入?
你确定zmq安装在电脑上吗?如果没有,请尝试安装它。在 ubuntu 中很容易 sudo apt-get install python-zmq
您需要将 zmq 目录添加到您的路径中。在 Python 脚本中,您应该添加如下内容:
import sys sys.path.append('/absolute/path/to/zmq/directory')