Python Forum

Full Version: import yaml error for python3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

#!/bin/python
import yaml
print('yaml')
Traceback (most recent call last):
File "test.py", line 2, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'
Yes, pyyaml is not installed in the python3, however it is installed and available in the python (python2).

So, how to install and make it available to python3 as well?

Any suggestions would be much appreciated. Thank you.
Regards,
Maiya
Type python3 -m pip install --user pyyaml in a terminal. Modules installed for one python are not visible from other pythons.
Thanks a lot Sir.
Hi Sir,

I have created a project using python (2) and wanted to migrate/support to python 3 now. So is there any best and efficient way to find out any code of the my project/product which is not supported to python 3.
My project contains (11k lines of code), I wanted to know this without executing any of the my unit test scenario.

Any helps regarding this would really helps and much appreciated. Thanks a lot
Regards,
Maiya
The simplest way to convert python 2 code into python 3 is to use the 2to3 program. Here is a very clear tutorial video about how to use it.