第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何解決 FileNotFoundError: [Errno 2] Python 3.7/Mac

如何解決 FileNotFoundError: [Errno 2] Python 3.7/Mac

瀟湘沐 2021-12-21 16:29:02
細(xì)節(jié):Python 3.7.1,Mac OS High Sierra 10.13.6。我正在使用 IDLE 并通過終端運(yùn)行程序。我最近在 MNIST 手寫數(shù)字上取得了成功,現(xiàn)在我正在嘗試用我自己的數(shù)據(jù)集訓(xùn)練一個生成對抗網(wǎng)絡(luò)。數(shù)據(jù)集是一個圖像文件夾。錯誤:Traceback (most recent call last):  File "Pride.py", line 29, in <module>    listing = os.listdir(path1)    FileNotFoundError: [Errno 2] No such file or directory: 'Users/darren/Desktop/Pride'我已經(jīng)查看了有關(guān)此問題的其他線程,但不明白我的路徑有什么問題,所以如果我的錯誤是由于一些簡單的原因,我深表歉意。我從終端執(zhí)行的 Python 文件和我的數(shù)據(jù)集文件夾都在我的桌面上。到目前為止,這是我的代碼:from keras.models import Sequentialfrom keras.layers.core import Dense, Dropout, Activation, Flattenfrom keras.layers.convolutional import Convolution2D, MaxPooling2Dfrom keras.optimizers import SGD,RMSprop,adamfrom keras.utils import np_utilsimport numpy as npimport matplotlib.pyplot as pltimport matplotlibimport osimport theanofrom PIL import Imagefrom numpy import *from sklearn.utils import shufflefrom sklearn.model_selection import train_test_split# input image dimensionsimg_rows, img_cols = 200, 200# number of channelsimg_channels = 1#%%#  datapath1 = "Users/darren/Desktop/Pride" #path of folder of images    path2 = "Users/darren/Desktop/Prideresized"  #path of folder to save imageslisting = os.listdir(path1) num_samples=size(listing)print ("num_samples")for file in listing:    im = Image.open(path1 + '\\' + file)       img = im.resize((img_rows,img_cols))    gray = img.convert('L')    gray.save(path2 +'\\' +  file, "JPEG")
查看完整描述

2 回答

?
慕妹3146593

TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超9個贊

在 mac os 中,如果您將數(shù)據(jù)集文件或任何其他文件保存在文檔文件夾中,則該文件路徑的代碼可能如下所示


melbourne_file_path = **'/Users/adi/Documents/Top250.csv'**

melbourne_data = pd.read_csv(melbourne_file_path) 

melbourne_data.describe()


查看完整回答
反對 回復(fù) 2021-12-21
?
開滿天機(jī)

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超13個贊

如果您使用相對路徑(不以 a 開頭的路徑/),您需要更改它們,使它們與腳本的位置相關(guān)。


在你的情況下:


path1 = "Pride" #path of folder of images    

path2 = "Prideresized"  #path of folder to save images


查看完整回答
反對 回復(fù) 2021-12-21
  • 2 回答
  • 0 關(guān)注
  • 394 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號