我用pip install cloudinary
安装了 cloudinary 准备上传照片.
进入 python 可以正常导入这个库:
>>> import cloudinary
>>> import cloudinary.uploader
>>> from cloudinary.uploader import upload
>>> cloudinary.__file__
'/home/xiao/anaconda2/lib/python2.7/cloudinary/__init__.pyc'
>>> cloudinary.uploader.__file__
'/home/xiao/anaconda2/lib/python2.7/cloudinary/uploader.pyc'
但是import cloudinary.uploader
写到文件里运行就会报错:
xiao@ubuntu:~/Earth$ python cloudinary.py
/home/xiao/Earth/cloudinary.pyc
Traceback (most recent call last):
File "cloudinary.py", line 8, in <module>
import cloudinary
File "/home/xiao/Earth/cloudinary.py", line 10, in <module>
import cloudinary.uploader
ImportError: No module named uploader
可有大神知道怎么回事?
1
squid157 2015-12-18 14:26:20 +08:00
你改个文件名?我忘记 Python 的搜索路径了
|
3
vmebeh 2015-12-18 14:31:53 +08:00
|
4
izoabr 2015-12-18 14:32:54 +08:00
搜索路径优先,你重名了,就没有去后面找了
|