python NameError: global name '__file__' is not defined
问题 When I run this code in python 2.7, I get this error: Traceback (most recent call last): File "C:\Python26\Lib\site-packages\pyutilib.subprocess-3.5.4\setup.py", line 30, in <module> long_description = read('README.txt'), File "C:\Python26\Lib\site-packages\pyutilib.subprocess-3.5.4\setup.py", line 19, in read return open(os.path.join(os.path.dirname(__file__), *rnames)).read() NameError: global name '__file__' is not defined code is: import os from setuptools import setup def read(*rnames):