notepad++編譯器儲存的python程式碼出現python:can't open file '**.py' :[error 2] No Such file or directory問題怎麼解決
初學Python的小白不懂編譯器儲存python程式碼如何在命令列模式下執行。很多小白在執行時會直接輸入python **.py。所以會出現如標題所述的問題。我將我的解決方式放在下面僅供參考。
- 輸入win+r開啟cmd磁碟介面。這裡系統預設是C盤。
- 如果直接輸入就會出現標題的問題
我的解決方式如下:
-
第一,首先要看看自己儲存的檔案是不是以.py結尾,我是在Notepad++下直接以.py儲存的
-
第二開啟磁碟執行介面,找到自己存檔案的地方,我的是E盤,先輸入e:進入E盤操作,我存python檔案的地方是專門為python專案儲存的檔案。找到這個目錄cd Projrcts\Python_Files。然後輸入python first.py進行執行。【這一步是看你將檔案存在了哪裡,然後輸入正確的路徑。】
-
總結:python檔案要在指定的路徑下才能進行操作。以上是我的解決方案。作為一個新手我要學習的東西也有很多,希望大家共同進步。
相關推薦
notepad++編譯器儲存的python程式碼出現python:can39;t open file 39;**.py39; :[error 2] No Such file or directory問題怎麼解決
初學Python的小白不懂編譯器儲存python程式碼如何在命令列模式下執行。很多小白在執行時會直接輸入python **.py。所以會出現如標題所述的問題。我將我的解決方式放在下面僅供參考。 輸入win+r開啟cmd磁碟介面。這裡系統預設是C盤。 如果直接輸入就會出現標題
python open開啟檔案失敗 IOError: [Errno 2] No such file or directory: 'E://aaa.txt'
我相信很多人在學習Python的時候,特別是在open檔案的時候總還碰到,還報錯IOError:[Errno 2]沒有這樣的檔案或目錄:'E://aaa.txt',而且你還覺得自己沒有寫錯,但就是打不開
出現這個 python: can't open file 'manage.py': [Errno 2] No such file or directory
在執行 python manage.py startapp app_name 或 django-admin.py startapp app_name 這樣的命令的時候,發現提示python:
django新建專案報錯python: can't open file 'manage.py': [Errno 2] No such file or directory
今天遇到此問題,一直報錯,不知道怎麼結果,網上我能找到的方式都試過了,還是不可以在pycharm下方的terminal終端中輸入命令:cd mysite 然後回車就可以了接著在pycharm下方的terminal終端中輸入命令:python manage.py startap
成功解決FileNotFoundError: [Errno 2] No such file or directory: 39;F:\\Program Files\\Python\\Python36\\li
解決問題 FileNotFoundError: [Errno 2] No such file or directory: 'F:\\Program Files\\Python\\Python36\\lib\\site-packages\\chatterbot_corpus\
mysql 安裝問題二:mysqld: Can39;t create directory 39;E:\Software\mysql-5.7.24-winx64\data\39; (Errcode: 2 - No such file or directory)
原因:my.ini檔案中的basedir(設定mysql的安裝目錄)、datadir(設定mysql資料庫的資料的存放目錄)與MySQL解壓後的路徑不一致 解決辦法: 將basedir=E:\Software\mysql-5.7.24-winx64 改為&nbs
Codeblocks 一直出現 codeblocks fatal error: **.h: No such file or directory
這幾天寫程式的時候動不動就出現這個惱人的錯誤,明明前一次編譯的時候還是好好的。但是繼續寫了一會兒,再編譯就又出現這個錯誤了。真的讓人丈二摸不著頭腦。今天仔細搜了搜 C++ 的命名規範,覺得應該是檔名命名錯了的原因。下面內容出自 Google C++ 風格指南 命名約定 檔案命名
解決CentOS 7出現Failed to issue method call: Unit iptables.service failed to load: No such file or direc
一直用CentOS 6 習慣了,一下沒適應過來。防火牆配置後執行service iptables save 出現"Failed to restart iptables.service: Unit iptables.se
編譯核心,出現gcc: error: elf_i386: No such file or directory
CC arch/x86/mm/mmio-mod.o LD arch/x86/mm/mmiotrace.o LD arch/x86/mm/built-in.o CC arch/x86/crypto/crc32c-inte
關於python 中出現 39;ascii39; codec can39;t decode byte 0xe9 in position 0: ordinal not in range(128)的解決辦法
由於python預設是ascii編碼 當python嘗試轉換為其他編碼的時候,要先把它轉換為unicode編碼,再轉成目標編碼 但是,Unicode編碼最大隻有128那麼長,因此超出了長度就會報這個錯誤。 方法1: 改變python檔案的預設編碼方式 import sys d
TensorFlow學習筆記7——Win7下Spyder執行python程式碼出現UnicodeEncodeError問題的解決
環境: win7+Anaconda1.6.3+Spyder3.2.1+tensorflow1.1.0 問題描述: 執行下述程式碼,讀取之前儲存的tfrecord檔案,
ubuntu 執行Python腳本出現: /usr/bin/env: ‘python ’: No such file or directory
pid pytho shell ati director htm stat 參數 art 原因: #!/usr/bin/env python 在ubuntu會變成 #!/usr/bin/env python\r 而\r 會被shell 當成參數 所以
解決Python程式碼編碼問題 SyntaxError: Non-UTF-8 code starting with 39;\xc139;
程式中出現中文,執行的時候出現如下錯誤: SyntaxError: Non-UTF-8 code starting with '\xc1' in file C:\...\xxx.py on line 8, but no encoding declared; see http://python
python join() 提示UnicodeDecodeError: 39;utf839; codec can39;t decode byte 0xcb in position 0: unexpected end of的原因及解決辦法
問題: 在使用join()將列表元素連線成字串時出錯如下 return split.join(result) UnicodeDecodeError: 'utf8' codec can't decode byte 0xcb in position 0: unexpected end of
使用python程式碼找到Python site-packages目錄位置
python第三方包都安裝到了site-packages目錄下了。 我們可以通過下面的python程式碼來找到它的位置: import os os.path.dirname(os.__file__) 這個路徑在不同作業系統下會有不同的值。
關於使用python的open函數出現No Such file or dir的錯誤
我寫的程式碼如下: 1 2 3 4 5 6 7 def createFileWithFileName(localPathParam,fileName): totalPath=local_url+'\\'+fileName if not
Linux 執行Python指令碼出現:No such file or directory
寫好了一個Python 指令碼後 準備在Linux上面執行。 使用的是 ./test.py 出現了 :No such file or directory 而在使用 python test.py 時卻是可以的。這個非常的讓人費解,於是刷了一下 stack over
"#!/usr/bin/python: No such file or director"引發的編碼問題
spa utf8 方法 文件頭 https span diff inux vi編輯器 問題描述 我自己寫了一個Python腳本,在Linux服務器和我的Mac上運行都報錯: ./build_system.py: line 1: #!/usr/bin/python: N
fatal error: Python.h: No such file or directory 解決
parrot python error pycrypto python.h [常見錯誤] fatal error: Python.h: No such file or directory環境場景系統: Parrot Linux軟件: 系統python默認版本2.7 PyCharm默認版本P
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file or directory
center ext tor jsb iss install all sdn plugin 裝一臺新服務器環境的時候,裝uwsgi報錯: plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such