發表文章

目前顯示的是有「Python」標籤的文章

[Python, Pyinstaller] Pyinstaller 打包出現 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position

Pyinstaller 打包 exe 檔案時,出現以下錯誤訊息 : UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position  GOOGLE 一下,解決方法如下 : 將 Pyinstaller 資料夾內的 compat.py找出來。 大約第370行, 將下列程式行更改 out = out.decode(encoding) out = out.decode(encoding, errors='ignore') 還有一種方法是在cmd先下指令 chcp 65001 python pyinstaller ...

[Python, pip] AttributeError: module 'clr' has no attribute 'AddReference'

想使用 DLL 文件, 需使用 clr 內的 AddReference 的函式, 因此我下了這個指令 : pip install clr 下了以後發現都會跑出 : AttributeError: module 'clr' has no attribute 'AddReference' 原來會噴錯的原因是因為我裝了 'clr', 其實只要安裝pythonnet即可。 pip uninstall clr pip install pythonnet

[Python, pip] ModuleNotFoundError: No module named 'pkg_resource.py2_warn'

建置 python 的 exe 執行檔時出現 ModuleNotFoundError: No module named 'pkg_resource.py2_warn'  檢查以後發現, 自己的setuptools版本是45.0.0, 降版本以後即可。 pip install setuptools==44.0.0

[Python] LeeCode 1. Two Sum

Language Information : Python3 Description : Two Sum URL :  https://leetcode.com/problems/two-sum/ Code : class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: arrayList = [] for i in range(len(nums)): subSum = target - nums[i] for x in range(i,len(nums)): if x==i: continue elif subSum == nums[x]: arrayList.append(i) arrayList.append(x) return arrayList break else: pass subSum = 0 - 宣告一個 arrayList  = []去存結果, 使用最外層的 for loop 巡 nums 這個 input list, 宣告參數 subSum 讓 target 減去正在被巡的for element, 使用內層 for loop 再次巡 nums 並找出是否還有相減後相符的數字, 找到後將其位置 append 至 arrayList, 若未找到則將 subSum 歸零,重新繼續尋找。

[CMake, TensorFlow, C++, Python] 使用CMake去編譯TensorFlow所要知道的事情...

怎樣編譯都出問題...直到看到這個表格...版本對了真的很重要呢...浪費我一整天... CPU 版本 Python 版本 编译器 构建工具 tensorflow-1.12.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.11.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.10.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.9.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.8.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.7.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.6.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.5.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.4.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.3.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.2.0 3.5-3.6 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.1.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 tensorflow-1.0.0 3.5 MSVC 2015 update 3 Cmake v3.6.3 GPU 版本 Python 版本 编译器 构建工具 cuDNN CUDA tensorflow_gpu-1.12.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15.0 7 9 tensorflow_gpu-1.11.0 3.5-3.6 MSVC 2015 update 3 Bazel 0.15...