C1_W1_deeplearning.mplstyle



After I downloaded the file, I put the file in this file address.
After opening the C1_W1_ file in jupyternotebook, I tried to run
plt.style.use(‘./deeplearning.mplstyle’)
But this time it shows TypeError: the ‘package’ argument is required to perform a relative import for ‘./deeplearning’.
The C1_W1_ file and the deeplearning.mplstyle file are in one folder.
May I ask how to solve this problem?

Hello!

This line of code is for styling purposes and won’t affect the rest of the code. Can you run the other cells without any errors?

Also, check the current directory of your notebook by running the below code:

import os
current_directory = os.getcwd()
print("Current directory:", current_directory)

Snipaste_2023-07-03_08-28-03
Current directory: C:\Users\74054\work
Thank you, I think it should be the need to manually change the address in brackets
plt.style.use(‘./deeplearning.mplstyle’)
How to change address?
Thank you!

I don’t think you need to change anything, as long as both files (notebook and deeplearning.mplstyle) are in the same directory. Are they?
I just ran this in my PC and not getting the TypeError. Maybe there are some spelling mistake in your case.

Thank you for your reply
But I don’t think it has anything to do with the typo
I downloaded the file directly from Coursera, and then copied the file to the address above.
As you can see from this picture, the two files are in one folder.



There are no other problems encountered in subsequent programming. The problem only occurs when calling files such as deeplearning.mplstyle.

OK! I don’t have any knowledge of how to resolve this issue. Maybe any other mentor will guide you.

Please verify that your matplotlib version is the same as the one used in Coursera’s lab.

I’m not sure, but you could try specifying the path as “.\\deeplearning.mplstyle” for Windows systems.

thank you!
I have solved the problem, the reason is that the matplotlib version is too new