所以我要重写这个问题。我已经安装了pycharm和python 3.7.2,并想从一个朋友那里导入一个在另一台电脑上运行完美的程序。当我尝试启动一个.py程序包时,不管它是什么代码,我都会收到这条消息。可能就这么简单:
print ("Hello World")
enter code here"C:\Users\****\PycharmProjects\Python RPG\venv\Scripts\python.exe"` "C:/Users/****/PycharmProjects/Python RPG/Tag 5 - 2 - Changing Pictures.py"
Traceback (most recent call last):
File "C:\Users\****\PycharmProjects\Python RPG\venv\lib\site.py", line 703, in <module>
main()
File "C:\Users\****\PycharmProjects\Python RPG\venv\lib\site.py", line 692, in main
aliasmbcs()
File "C:\Users\****\PycharmProjects\Python RPG\venv\lib\site.py", line 515, in aliasmbcs
import locale, codecs
File "C:\Users\****\PycharmProjects\Python RPG\venv\lib\locale.py", line 19, in <module>
import functools
ImportError: No module named functools
Process finished with exit code 1
有趣的是:在我的朋友的电脑上,代码甚至是这样写的:
print "hello world"
似乎缺少某种工具集。也许这个枕头或者圆周率。如您所见:在第一段代码中,我不需要任何函数,但稍后我需要:
import Image, ImageTk #Necesary to display pictures
import Tkinter
root = Tkinter.Tk()
img = ImageTk.PhotoImage(Image.open("Cat.jpg"))
panel = Tkinter.Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()
这里您看不到的是pycharm underlays import和带有红线的imagetk,表示这些函数未知。