Import? Operating System (operating system)
File name? =? f:/ 123.txt '
What if? Os.path.exist (file name):? Os.remove (file name).
How to install python in a virtual environment?
1 Install python development
Sudo apt-get installs python-dev.
2 install libmysqlclient-dev
sudo apt-get install libmysql client-dev .
3 install mysql-python
Pip installs mysql-python.
4. finally verify it.
(py3)PC @ PC-virtual-machine:~/work/VENV/py3/bin $ python
Python 2.7.6 (default 20 15, 18:00: 18)?
[GCC 4.8.2] on linux2
Type Help, Copyright, Credit or License for more information.
& gt& gt& gt import MySQLdb
& gt& gt& gt
5. If there is no problem in the import, the import is successful.