Leviticus 19:4 enjoins:
אַל־תִּפְנוּ֙ אֶל־הָ֣אֱלִילִ֔ם וֵֽאלֹהֵי֙ מַסֵּכָ֔ה לֹ֥א תַעֲשׂ֖וּ לָכֶ֑ם אֲנִ֖י ה' אֱ-לֹקיכֶֽם׃
Do not turn to the idols and do not make molten gods for yourselves, I am the LORD your G-d.
The Sifra (Kedoshim 1) expounds:
"אל תפנו אל האלילים" – אל תפנה לעבדם. ר' יהודה אומר אל תפנה לראותם ודיו.
"Do not turn to the idols" - Do not turn to serve them. R. Yehudah says: Do not turn to see them and that is enough for it.
Accordingly, Maimonides codifies (Laws of Idolatry 2:2):
סְפָרִים רַבִּים חִבְּרוּ עוֹבְדֵי כּוֹכָבִים בַּעֲבוֹדָתָהּ הֵיאַךְ עִקַּר עֲבוֹדָתָהּ וּמַה מַּעֲשֶׂיהָ וּמִשְׁפָּטֶיהָ. צִוָּנוּ הַקָּדוֹשׁ בָּרוּךְ הוּא שֶׁלֹּא לִקְרוֹת בְּאוֹתָן הַסְּפָרִים כְּלָל וְלֹא נְהַרְהֵר בָּהּ וְלֹא בְּדָבָר מִדְּבָרֶיהָ. וַאֲפִלּוּ לְהִסְתַּכֵּל בִּדְמוּת הַצּוּרָה אָסוּר שֶׁנֶּאֱמַר (ויקרא יט ד) "אַל תִּפְנוּ אֶל הָאֱלִילִים". וּבָעִנְיָן הַזֶּה נֶאֱמַר (דברים יב ל) "וּפֶן תִּדְרשׁ לֵאלֹהֵיהֶם לֵאמֹר אֵיכָה יַעַבְדוּ", שֶׁלֹּא תִּשְׁאַל עַל דֶּרֶךְ עֲבוֹדָתָהּ הֵיאַךְ הִיא אַף עַל פִּי שֶׁאֵין אַתָּה עוֹבְדָהּ, שֶׁדָּבָר זֶה גּוֹרֵם לְהִפָּנוֹת אַחֲרֶיהָ וְלַעֲשׂוֹת כְּמָה שֶׁהֵן עוֹשִׂין שֶׁנֶּאֱמַר וְאֶעֱשֶׂה כֵּן גַּם אָנִי:
The idolaters compiled many books of worship, defining its principle manner of service, its works and its laws; but the Holy One, blessed be He! charged us not to read those books at all, not to think of idolatry generally nor of aught of its details. Moreover, to look at it is forbidden, as it is said: "Turn ye not unto idols" (Lev. 19.4.); and of thinking on this subject it is said: "And that thou inquire not after their gods, saying, How did these nations serve their god"? (Ibid.), which is a warning that thou shalt not inquire concerning its manner of practice, though thou art not worshiping it, for this very inquiry causes a turning after it and to imitate their practice, as it is further said: "Even so will I do likewise" (Ibid.).
Indeed, according to Maimonides, one incurs lashes for violating this prohibition (Sefer HaMitzvoth, Prohibition 10):
שהזהירנו מנטות אחר ע"ז ומהתעסק בספוריה, רוצה לומר בזה העיון ברוחניות, כלומר הכוכב פלוני ירד על תאר כך ויעשה כך והפלוני יקטירו לו ויעמדו לפניו על תאר כך ויעשה הדבר הפלוני ומה שילך על הדרך הזה, כי המחשבה באלו הדברים והעיון באלו הלשונות הוא מה שיעורר האדם לבקש אותם ועבודתם, והכתוב אשר הזהירנו מזה הענין הוא אמרו אל תפנו אל האלילים. ולשון ספרי אם פונה אתה אחריהם אתה עושה אותם אלהות. ושם אמרו רבי יהודה אומר אל תפנה לראותם, אפילו להסתכל צורת הצלם הנראית והמחשבה בעשיתה אינו מותר כדי שלא יתעסק חלק הזמן בחלק ממנה. ובפרק שואל אדם (דף קמ"ט) אמרו כתב המהלך תחת הצורה ותחת הדיוקנאות אסור לקרותו בשבת ודיוקנא עצמה אפילו בחול אסור להסתכל בה משום שנאמר אל תפנו אל האלילים מאי תלמודא א"ר יוחנן אל תפנו אל מדעתכם. וכבר נכפלה האזהרה בזה הענין בעצמו רוצה לומר באיסור מחשבה בע"ז, והוא אמרו יתעלה השמרו לכם פן יפתה לבבכם רוצה לומר כי כשתעמיק לבך לחשוב בה יהיה מביא אותך לסור מן הדרך ולהתעסק בעבודתה. ואמר גם כן בזה הענין בעצמו ופן תשא עיניך השמימה, כי לא בא להזהיר האדם (ראשונה) שלא לראות אותם בעיניו, ואמנם הזהיר מן הענין במה שיתיחס אל עבודתם בעיון הלב. וכן אמר פן תדרוש לאלהיהם יזהיר מלדרוש איכות עבודתם אע"פ שלא יעבדם שזה כולו מביא לטעות בהם. ודע שהעובר על זה חייב מלקות. וכבר התבאר בסוף פ"ק מעירובין (דף י"ז:) על מה שאמרו לוקים על עירובי תחומין ושמו ראיית זה אמרו אל יצא איש ממקומו, והקשה אחד ואמר ואיך ילקה מלקות על אזהרה במלת אל ולא באה האזהרה במלת לא, והשיבו על צד הקושיא וכי כל מה שיבא במלת אל אין לוקין עליו אלא מעתה אל תפנו אל האלילים ה"נ דלא לקי, הנה הורה כי לאו זה לוקין עליו. (קדושים תהיו, שם פ"ב):
That He prohibited us from inclining towards idolatry and occupying ourselves with its narratives - meaning to say, into this study of spirituality. [That] means, star x descends according to this description and [then] does such; and [when] they burn incense to y and stand before it according to this description, it does thing z - and that which goes in this way. For thought about these things and study with these [types of] expressions is what arouses a person to seek them and their worship. And the verse that prohibited us from this content is His saying, "Do not turn to the idols" (Leviticus 19:4). And the language of the [Sifra] (Sifra, Kedoshim, Chapter 1:11) is, "If you turn to them, you make them gods." And there (Sifra, Kedoshim, Chapter 1:10), they said, "Rabbi Yehudah says, 'Do not turn to see them'" - it is not even permissible to observe the appearance of the image's form and the thought of its construction, so that one not spend any time [involved with any] part of it. And in the chapter [entitled] Shoel Adam (Shabbat 149a), they said, "[Regarding] writing that is under a picture or under graven images (deyokenaot), it is prohibited to read it on Shabbat. And [regarding] the image itself, even on a weekday it is prohibited to look at it, because it it is stated, 'Do not turn to the idols.' What is the [derivation from this verse]? Rabbi Yochanan said, 'Do not make a god from your minds.'" And the prohibition about this very content - meaning about the prohibition of the thought of idolatry - has already been repeated. And that is His, may He be exalted, saying, "Take heed to yourselves, lest your heart be seduced" (Deuteronomy 11:16). [This] means to say [that] if you have your heart delve into it, it will bring you to veer from the [true] path, and to become involved in its [actual] worship. And He also said about this exact content, "And lest you lift your eyes to the sky" (Deuteronomy 4:19). For He did not come to forbid a person from seeing them with his eyes, but rather forbade the matter in which one relates to their worship with the interest of the heart. And likewise, His saying, "lest you inquire about their gods," is forbidding the inquiry about the nature of their worship, even though one does not worship them. For this all leads to erring about them. And you should know that one who transgresses this is liable for lashes. And this has already been made clear at the end of the first chapter of Eruvin (Eruvin 17b), regarding that which they said, [that] we give lashes for [going outside of] the mixing of perimeters (eruvei techumin). And they gave as a proof, His saying, "let no (al) man go out of his place" (Exodus 16:29); and someone asked and said, "But how can they give lashes for a prohibition, with the word, al, when the commandment did not come with the word, lo? And they answered him rhetorically, "And do we not give lashes for anything that comes with the word, al? But if so, we would also not give lashes for, 'Do not turn to the idols!'" Behold this indicates that we give lashes for this negative commandment. (See Parashat Kedoshim; Mishneh Torah, Foreign Worship and Customs of the Nations 2.)