Python Forum
import yaml error for python3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import yaml error for python3
#1
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
Reply
#2
Type python3 -m pip install --user pyyaml in a terminal. Modules installed for one python are not visible from other pythons.
Reply
#3
Thanks a lot Sir.
Reply
#4
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
Reply
#5
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up Parsing a YAML file without changing the string content..?, Flask - solved. SpongeB0B 2 381 Aug-05-2021, 08:02 AM
Last Post: SpongeB0B
  import module with syntax error Skaperen 7 767 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 1,009 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Folium import error kashif_flavio 2 971 Dec-07-2020, 08:58 AM
Last Post: bowlofred
  Import error Beingcode 0 1,020 Nov-20-2020, 02:57 AM
Last Post: Beingcode
Smile Import error with local file colt 1 670 Nov-08-2020, 07:56 AM
Last Post: Gribouillis
  switch from version 3.5.3 to 3.8.6 get import error python001 9 1,319 Oct-31-2020, 03:02 PM
Last Post: python001
Bug maximum recursion depth exceeded while calling a Python object error in python3 Prezess 4 1,881 Aug-02-2020, 02:21 PM
Last Post: deanhystad
  Which app do I import to fix this error? ErnestTBass 6 1,921 Apr-26-2020, 08:43 PM
Last Post: snippsat
  Error while humansize module import. johnkgson 3 1,609 Apr-26-2020, 08:37 AM
Last Post: johnkgson

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020