To give a very simple example, if you find a package or module, there is obviously, but this error will occur:
>>> from algorithm Import *
Traceback (most recent):
File "<stdin>", line 1, in <module>
Importerror:no module named algorithm
Then there's the problem with the environmental variables.
Okay, let's see how.
>>>>> Import Sys
>>> Sys.path
[', '/usr/lib/python2.7 ', '/usr/lib/python2.7/plat-linux2 ', '/usr/lib/python2.7/lib-tk ', '/usr/lib/python2.7/ Lib-old ', '/usr/lib/python2.7/lib-dynload ', '/usr/local/lib/python2.7/dist-packages ', '/usr/lib/python2.7/ Dist-packages ', '/usr/lib/python2.7/dist-packages/pil ', '/usr/lib/python2.7/dist-packages/gst-0.10 ', '/usr/lib/ python2.7/dist-packages/gtk-2.0 ', '/usr/lib/pymodules/python2.7 ', '/usr/lib/python2.7/dist-packages/ Ubuntu-sso-client ', '/usr/lib/python2.7/dist-packages/ubuntuone-client ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-control-panel ', '/usr/lib/python2.7/dist-packages/ubuntuone-couch ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-installer ', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol ']
First, these show Python's own environment variables
And then
>>> sys.path.append ('/media/file/code_downloadcodeandselfcode/pyworkplace/xview ')
>>> Sys.path
[', '/usr/lib/python2.7 ', '/usr/lib/python2.7/plat-linux2 ', '/usr/lib/python2.7/lib-tk ', '/usr/lib/python2.7/ Lib-old ', '/usr/lib/python2.7/lib-dynload ', '/usr/local/lib/python2.7/dist-packages ', '/usr/lib/python2.7/ Dist-packages ', '/usr/lib/python2.7/dist-packages/pil ', '/usr/lib/python2.7/dist-packages/gst-0.10 ', '/usr/lib/ python2.7/dist-packages/gtk-2.0 ', '/usr/lib/pymodules/python2.7 ', '/usr/lib/python2.7/dist-packages/ Ubuntu-sso-client ', '/usr/lib/python2.7/dist-packages/ubuntuone-client ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-control-panel ', '/usr/lib/python2.7/dist-packages/ubuntuone-couch ', '/usr/lib/python2.7/dist-packages/ Ubuntuone-installer ', '/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol ', '/media/File/Code_ Downloadcodeandselfcode/pyworkplace/xview/emotionanalyse ', '/media/file/code_downloadcodeandselfcode/ Pyworkplace/xview ']
>>> Import algorithm
In this way, I have imported my algorithm into this package.
It's OK!
But there is a problem, the next time you have to set up.
Then change the system variable:
$export pythonpath= $PYTHONPATH:/home/yourselfpath
Pro-Test Effective ~
"Go" python modifies OS environment variables