JinXing F
JinXing F

Reputation: 11

ImportError: No module named deploy

root@ubuntu:/home/ubuntu# 
root@ubuntu:/home/ubuntu# python 
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information. 
>>> import paste
>>> import paste.deploy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named deploy
>>> from paste import deploy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name deploy
>>> from paste.deploy import loadwsgi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named deploy

why i can import the paste,but i cannot import the paste.deploy. i run the python by root,please explain it. i am a new python

Upvotes: 1

Views: 6732

Answers (3)

Davide Farris
Davide Farris

Reputation: 21

$ pip uninstall paste

$ pip install paste

Upvotes: 1

JinXing F
JinXing F

Reputation: 11

first,uninstall paste or paste deploy second,install paste deploy by follows:

$ hg clone http://bitbucket.org/ianb/pastedeploy
$ cd pastedeploy
$ sudo python setup.py develop

it will work well.

Upvotes: 0

Joe Young
Joe Young

Reputation: 5885

paste and paste.deploy are 2 separate modules. You have to install both of them.

To install paste.deploy:

pip install pastedeploy

If it installed correctly, you should be able to run the following in the python interpreter to confirm it's available for use:

>>> import paste
>>> import paste.deploy
>>> paste.deploy.__path__
['/Users/joeyoung/.virtualenvs/reversemapping/lib/python2.7/site-packages/paste/deploy']

Packages support one more special attribute, ____path____. This is initialized to be a list containing the name of the directory holding the package’s ____init____.py before the code in that file is executed.

https://docs.python.org/2.7/tutorial/modules.html#packages-in-multiple-directories

Upvotes: 2

Related Questions