Some Questions and Anwsers about Python, OpenCV, Ubuntu, cuda, tensorflow-GPU

This article records some questions and answers about Python, OpenCV, Ubuntu, cuda, tensorflow-GPU when I worked as deep learning.

Q1: An error occurs when I copy the files to USB flash disk. The error code is “no space left on device“. But actually the size of this files are smallar than USB flash disk capacity.

A1: The files are lots of pictures. Becuase I didn’t compress them, so it needs lots of inodes. So the error occured. What we need to do is to compress them and try to copy it again.

Q2:How to update pip?

A2: Run the command “python -m pip install –upgrade pip“. If it doesn’t work, run this command “sudo pip install –upgrade pip“.

Q3: There is no suitable installation version and timeout when install python module by using pip.

A3: Run this command “sudo pip –default-timeout-100 install tqdm“. I assume the python module is tqdm.

Q4: Using “sudo pip –defalut-timeout=100 install cv2” to install cv2, but it says that there is no suitable version.

A4: We can use “sudo pip –defalut-timeout=100 install opencv-python” to install it.

Q5: How to install sublime text 3 in terminal under Ubuntu.

A5: Using this command “sudo add-apt-repository ppa:webupd8team/sublime-text-3”.

C6: The default python path is /usr/local/lib/ in ubuntu. Tensorflow is installed to python 2.7 by default. Using pip or python to install tensorflow, it will install tensorflow to python2.7 directory. Using pip3 or python3 to install tensorflow, it will install tensorflow to python3.5 directory.

Q7: “inconsistent tabs and space error” in python.

A7: Replace the tab with space.

Q8: How to know the version of cv2.

A8:

import cv2
    if __name__ == '__main__':
    print(cv2.__version__)

Q9: How to replace a string in ubuntu?

A9: Open a file with Vi, In command mode, Using “:%s/oldString/newString/g”. /g means all string.

Q10: Error : ./bin/bash^M: bad interpreter: no such file or directory

A10: Vi [filename], in comand mode, “: set ff=unix”, save and exit.

Q11: After installing cuda, run tensorflow. The error: libcudart.so.8: cannot open shared object file: No such file or diectory.

A11: It means cuda and cudnn don’t match. So You need to do three things.
Step 1: Install new cuda or cudnn.
Step 2: Copy the cudnn to cuda folder.
Step 3: Close the terminal and open it.

If you find this article is useful for you, I am really appreciate you to share it with your friends, classmates, colleagues.

If you find this article is useful for you, I am really appreciate you to share it with your friends, classmates, colleagues.

Note: Please don’t copy the article content to your blogs. Thanks!

Share this article to your social media
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments