のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Python

python debug modeで実行しているかどうか判断する方法

stackoverflow.com

ERROR: Could not install packages due to an EnvironmentError:

pip install -r requirements.txt 以下のようなエラーが出た。 何回も、 pip install -r requirements.txt を行うと、進むときもある。 進まない場合だけ、個別に、ダウングレードを行った。 ERROR: Could not install packages due to an EnvironmentError:…

ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

import defcon import extractor ufo = defcon.Font() extractor.extractUFO("./font.otf", ufo) ufo.save("./font_otf.ufo") pypi.org UnicodeかAscii以外の文字があるから、エラーなのかな? myExtracotr2.py Traceback (most recent call last): File "fo…

"pip install"と"pip install --upgrade"のupgradeはなにかhelpを調べてみた

"pip install"でよく、"pip install --upgrade"がついている、upgradeとはなにか調べてみた。 依存関係を、チェックしてくれるから、使うのかな? pip installだと、指示された通り、installしてしまう pip install --upgrade だと、依存関係をチェックして…

cu2qu error "Running setup.py install for appdirs ... error"

依存していそうなモジュール Installing collected packages: appdirs, fs, fonttools, cu2qu (Dev) C:\>cd users (Dev) C:\Users>cd m_fuj (Dev) C:\Users\m_fuj>cd Doc (Dev) C:\Users\m_fuj\Doc>cd github (Dev) C:\Users\m_fuj\Doc\GitHub>cd cu2qu (Dev…

Windows terminal(preview)で、anaconda コマンドプロンプトを開く方法

スタート>AnacondaPrompt>その他>ファイルの場所を開く ファイルの場所 ファイルを選択して、右クリック>ファイルのプロパティをクリックする。 ファイルのプロパティ リンク先の内容をコピペする。 リンク先 %windir%\System32\cmd.exe "/K" C:\Program…

windowsで、pycharmの日本語化

スタートのファイルの場所を開く 1. スタートのファイルの場所を開く ショートカットのプロパティを開き、ファイルの場所を開く ショートカットのプロパティ binにたどり着くのでlibへ移動する。 bin libへ、resources_jp.jarをコピーする。 pycharmを再起動…

dataframeから、複数範囲を指定したいとき

df_train = pd.read_csv(TRAIN_CSV) df_valid = pd.read_csv(VALID_CSV) df_test0 = df_valid.iloc[ 0:NB_CLASSES*1,:] #Bold df_test1 = df_valid.iloc[NB_CLASSES*1:NB_CLASSES*2,:] #Heavy df_test2 = df_valid.iloc[NB_CLASSES*2:NB_CLASSES*3,:] #Light…

matplot 文字化け

shimolab01.blogspot.com

Visual Studio CodeでPythonをデバッグしようとしたときエラーになった

そのようなファイルやディレクトリはありません bashが動いている。 xset: unable to open display "localhost:0.0" xset: unable to open display "localhost:0.0" $ cd "c:\Users\m_fujii\Documents\0700_JNB\XJIS" ; env PYTHONIOENCODING=UTF-8 PYTHONUN…

UnicodeDecodeError: 'cp932' codec can't decode byte 0x83 in position 8: illegal multibyte sequence

--------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) <ipython-input-30-2b56de3687e9> in <module> 12 is_unicode = True, 13 is_by_char = True, ---> 14 is_recursive =False) ~\Documents\0700_JNB\XJIS\font2i</module></ipython-input-30-2b56de3687e9>…

TypeError: argument of type 'WindowsPath' is not iterable

Pathlib path.namestackoverflow.com

InvalidArgumentError: Input to reshape is a tensor with 3200 values, but the requested shape requires a multiple of 49

VAEのもとのソースをgoogle colabで実行したら、以下のようなエラーがでた。 for i in range(30000): batch = [np.reshape(b, [28, 28]) for b in mnist.train.next_batch(batch_size=batch_size)[0]] sess.run(optimizer, feed_dict = {X_in: batch, Y: bat…

python pandas tail().T

tail()したものを、転置していた。

jupyter notebook windows remote

Windows10 Anaconda Jupyter notebook(e:\Anaconda3) C:\Users\user01>jupyter notebook --generate-config Writing default config to: C:\Users\m_fujii\.jupyter\jupyter_notebook_config.py(e:\Anaconda3) C:\Users\user01>ipython Python 3.6.1 |Anacon…

TypeError: array([[ 6.47354955]]) is not JSON serializable

エラーが出てるけど、通った。 Traceback (most recent call last): File "vm_main.py", line 33, in <module> import main File "/tmp/vmuser_cjxpbyuhoz/main.py", line 2, in <module> import studentMain File "/tmp/vmuser_cjxpbyuhoz/studentMain.py", line 61, in <module> sy</module></module></module>…

DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17

エラーの場合: reg.predict([27])正常の場合: 角カッコの数が2個だった。 reg.predict([[27]])/usr/local/lib/python2.7/dist-packages/sklearn/utils/validation.py:386: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will…

Python リスト内包表記

Pythonで一行で書いてるひとがいた。qiita.comwww.lifewithpython.com

Visual Studio Python No module named email_preprocess

Visual Studioで実行するとき、 カレントディレクトリが違うため、 エラーになっているようだ。 No module named email_preprocessカレントディレクトリがソリューションファイルの位置になる。 >>> import os >>> os.getcwd() 'D:\\0510_udacity' 変更前 im…

un(shallow)copyable object of type <type 'Element'>

un(shallow)copyable object of type <type 'Element'>Pythonのstandard libraryまで、デバッグしたいとき、以下にチェックすると入れる。 stackoverflow.com</type>

Visual Studio Python default environment

デフォルトの環境を変更するには、対象の環境を選択して、その下にある[Make this default environment for new projects]をクリックする。 www.atmarkit.co.jp

windows anaconda python2.7

>conda info --envs # conda environments: # root * C:\Users\u01\Anaconda3>conda create -n py27con python=2.7 anaconda Fetching package metadata ........... Solving package specifications: . Package plan for installation in environment C:\Us…

octave svd 特異値分解

特異値分解 mathtrain.jprank mathtrain.jpeigenvectors 固有ベクトル、固有値ベクトル ejje.weblio.jp

octave closest 距離

scicomp.stackexchange.com ノルム mathtrain.jp

octave bsxfun

> help bsxfun 'bsxfun' is a built-in function from the file libinterp/corefcn/bsxfun.cc -- bsxfun (F, A, B) The binary singleton expansion function performs broadcasting, that is, it applies a binary function F element-by-element to two ar…

hinge loss function:

Using this syntax, we can put it all together, obtaining the hinge loss function: L_{i} = \sum_{j \neq y_{i}} max(0, s_{j} - s_{y_{i}} + 1) Note: I’m purposely skipping the regularization parameter for now. We’ll return to regularization i…

python which

$ which pylint /Users/m/.pyenv/shims/pylint$ which pep8 /Users/m/.pyenv/shims/pep8$ which python /Users/m/.pyenv/shims/python $ python -V Python 3.4.5 :: Anaconda 2.3.0 (x86_64)

pylint error

[pylint] E0401:Unable to import 'dataset.mnist' [pylint] C0413:Import "from dataset.mnist import load_mnist" should be placed at the top of the module[pylint] E0401:Unable to import 'dataset.mnist'

conda config --show

$ conda config --show add_anaconda_token: True add_pip_as_python_dependency: True allow_softlinks: True always_copy: False always_yes: False auto_update_conda: True binstar_upload: None changeps1: True channel_alias: https://conda.anaconda…

mac anaconda

# Anacondaのインストール pyenv install anaconda3-2.1.0qiita.com $ pyenv versions system * 2.7.10 (set by /Users/u01/.pyenv/version) 2.7.9 3.4.3 anaconda3-2.3.0 $ pyenv global anaconda3-2.3.0 $ pyenv versions system 2.7.10 2.7.9 3.4.3 * ana…