程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Linux yocto system Python configuration problems and Solutions

編輯:Python

Preface

Use MTK 8516 Platform configuration linux Yocto The system configuration python Many errors are reported in the environment , Record these problems and solutions , For your reference .

1. pip install Imported , however impot Tips no module named

Reference link :https://blog.csdn.net/qq_39915318/article/details/106003608

terms of settlement : stay linux Use... On the command line expert Tools :

export PYTHONPATH=/usr/local/lib/python3.5/dist-packages

here , You can print echo $PYTHONPATH Check whether the addition is successful :
stay Yocto The system default python3.5 The library download path for is :/usr/lib/python3.5/site-packages,
So the command should be :

export PYTHONPATH=/usr/lib/python3.5/site-packages.

2. install numpy Report errors RuntimeError: Running cythonize failed!

terms of settlement : Compilation and installation cython

3. install numpy Tips RuntimeError: Broken toolchain: cannot link a simple C program

This is actually pip Updating numpy When it comes to problems .
resolvent :

ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip3 install numpy

stay Python27\Lib\distutils\msvc9compiler.py In file , find
mfinfo = self.manifest_get_embed_info(target_desc, ld_args) It will be changed to
mfinfo=none

stay linux The system uses find command :
find -name ‘msvc9compiler.py’
/usr/lib64/python3.5/distutils/msvc9compiler.py

4. Tips ‘no such file “ref.txt”’

yes python The problem of absolute path and relative path in , modify path Is the absolute path of the current file .
Method :

filepath = os.path.dirname(__file__) + '/'

5. There is a problem with the installation package , Mainly from aip import AipSpeech、import speech_recognition as sr Medium aip、speech_recognition Why did the package not install successfully ?

terms of settlement : These two packages are special , stay import The time is aip and speech_recognition, But in install The installation time is baidu-aip and SpeechRecognition,

6. Use ffmpg Combine multichannels into mono :

ffmpeg -i 1.wav -f wav -ac 1 -ab 16 -y mono.wav

7. Tips :UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\u3002’ in position 22: ordinal not in range(128).

reason :linux The output code in the environment is ansi, No utf-8.

Reference link :utf-8 problem

terms of settlement : Add a condition to the front :PYTHONIOENCODING=utf-8 ,
The perform

PYTHONIOENCODING=utf-8 python3 A1hub.py

8. Tips :{‘err_detail’: ‘4: Open api request limit reached’, ‘err_msg’: ‘4: Open api request limit reached’, ‘err_no’: 502, ‘err_subcode’: 4, ‘tts_logid’: 885259082}

Question why : Baidu api There is no voice synthesis service in .

terms of settlement : Open voice synthesis service in Baidu console ( Can claim 5000 One time free quota ).

9. Tips :OSError: [Errno 30] Read-only file system: '/usr/lib/python3.5/site-packages……

reason : The folder is read-only , Write permission is required .

Method : perform

mount -o remount,rw rootfs /

10. Baidu TTS api Output wav File format garbled .

problem : Baidu TTS api Output file format is not set in .

Reference link :https://www.cnblogs.com/Jorgensen/p/11546486.html

resolvent :aue Parameter selection 6.6 Corresponding wav Format , The default is output mp3 Format .

Parameter interpretation :
PER = 0# The speaker chooses , Basic sound library :0 For the sake of Xiaomei ,1 For Du Xiaoyu ,3 For the sake of leisure ,4 For Du ya ya ,# Quality Music Library :5 For the sake of Xiaojiao ,103 For dumido ,106 Wei Du Bowen ,110 For kids ,111 For Du Xiaomeng , The default is Du Xiaomei
SPD = 4# The speed , Value 0-15, The default is 5 Chinese speaking speed
PIT = 5# tone , Value 0-15, The default is 5 Chinese tone
VOL = 5# The volume , Value 0-9, The default is 5 Medium volume
AUE = 3# Download file format , 3:mp3(default) 4: pcm-16k 5: pcm-8k 6. Wav
FORMATS = {3: “mp3”, 4: “pcm”, 5: “pcm”, 6: “wav”}
FORMAT = FORMATS[AUE]

11. Tips :RankWarning: Polyfit may be poorly conditioned

Question why :MAC upgrade BigSur after python3.9 Follow numpy Are not compatible .

terms of settlement : Execute first

brew install openblas

Re execution

OPENBLAS="$(brew --prefix openblas)" pip3 install numpy

12. install Matplotlib The library reported an error (macOS,BigSur edition )

reason : upgrade setuptools To version 51.

Reference link :https://stackoverflow.com/questions/64884415/cant-install-matplotlib-on-macos-big-sur

Method :

pip3 install setuptools==51 --user

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved