[英]Can't import modules that are there
From command line I can't import appengine, this might be something with my python path: 从命令行我无法导入appengine,这可能是我的python路径:
$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.appengine.ext import db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "google/appengine/ext/db/__init__.py", line 98, in <module>
from google.appengine.api import datastore
File "google/appengine/api/datastore.py", line 62, in <module>
from google.appengine.datastore import datastore_query
File "google/appengine/datastore/datastore_query.py", line 64, in <module>
from google.appengine.datastore import datastore_index
File "google/appengine/datastore/datastore_index.py", line 60, in <module>
from google.appengine.api import validation
File "google/appengine/api/validation.py", line 51, in <module>
import yaml
ImportError: No module named yaml
>>>
I don't want duplicate installations, I want to point the Python interpretor to where the missing module is. 我不想重复安装,我想将Python解释器指向缺少模块的位置。 How do I make the interpretor find the app engine modules from the command prompt?
如何让解释器从命令提示符中找到app引擎模块? In the application these imports are working.
在应用程序中,这些导入正在运行。
appending: 追加:
/usr/local/google_appengine/:/usr/local/google_appengine/lib/:/usr/local/google_appengine/lib/yaml/
to your PYTHONPATH environment variable should do the trick (your SDK location may vary). 到你的PYTHONPATH环境变量应该做的伎俩(你的SDK位置可能会有所不同)。
For appengine 1.9.6 google has created a new directory "yaml-3.10" that contains the yaml module. 对于appengine 1.9.6,谷歌创建了一个包含yaml模块的新目录“yaml-3.10”。 I added "[appengine install directory]/google_appengine/lib/yaml-3.10" to PYTHONPATH in my .bashrc file and that solved this problem.
我在.bashrc文件中向PYTHONPATH添加了“[appengine install directory] /google_appengine/lib/yaml-3.10”,解决了这个问题。 BTW: I use Ubuntu 14.04 LTS.
顺便说一句:我使用的是Ubuntu 14.04 LTS。
yaml is not installed in your current setup. yaml未安装在您当前的设置中。 yaml package is included with google_appengine in the lib folder.
yaml包包含在lib文件夹中的google_appengine中。 the setup.py script in the folder will add the yaml package to your current python
该文件夹中的setup.py脚本将yaml包添加到当前的python中
cd google_appengine/lib/yaml
sudo python setup.py install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.