I’ve writen the python file, using it to read images’ name, assign the same label to images in the same folder. Before this, I successfully run them in pycharm. However there seems to be a pure python without IDE in the server and I have to run .py in its terminal. There are some points deserve attention:
- the running command is
./filename.py
, the same asfilename.sh
previously run. - when I successfully run it, there is some errors:
the main error is import: not found
. Notice that it’s not some module not found but the import
itself. The reason is that I failed to specify which python to execute this .py. So I write this on the first line:
#!/usr/bin/python
If you want to use your python with specific environments, you can write:
#!/usr/bin/env python
Their differences are concluded as:
- Fixing that, there is another error:
write this in the front:
#< pre class ="python" name="code" > # coding:utf-8
Other Tips
Tip 1:
frac = (float)(12000/40114) >> 0.0
frac = (float)12000/40114 >> error
frac = float(12000)/40114 >> 0.299
Tip 2:
tab
is 8 characters, so anti-tab
move both 4-indent and 8-indent content to the first colum. This may cause some logical errors.
近期评论