Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
プログラムが既にターゲットの場所にあるかどうかを確認し、そうでない場合は別の場所に移動するようにするにはどうすればよいですか?
os.path.abspath(__file__)py2exe で動作する代替手段はsys.executable. filename = sys.executable.rsplit('\\',1)[1] filename がファイル名になると言う場合。これは py2exe でプログラムをコンパイルする場合にのみ機能しますが、それ以外の場合は pythonw.exe または python.exe が表示されるだけです
os.path.abspath(__file__)
sys.executable
filename = sys.executable.rsplit('\\',1)[1]