目录
一、python版本不对
1.1 下载python2.6
1.2 安装python2.6
1.3 安装遇到问题
二、安装hashlib
三、更新3588 SDK代码
一、python版本不对
我的环境的python版本是python3.7。初次安装的时候执行命令报错,说是版本不对导致
fuh@dell:rk3588_sdk$ .repo/repo/repo sync -l
warning: Python 3 support is currently experimental. YMMV.
Please use Python 2.6 - 2.7 instead.
/home/fuh/guide/3588/rk3588_sdk/.repo/repo/main.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "/home/fuh/guide/3588/rk3588_sdk/.repo/repo/git_config.py", line 198, in GetBranch
b = self._branches[name]
KeyError: 'default'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/fuh/guide/3588/rk3588_sdk/.repo/repo/git_config.py", line 188, in GetRemote
r = self._remotes[name]
KeyError: 'origin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/fuh/guide/3588/rk3588_sdk/.repo/repo/git_config.py", line 131, in GetString
v = self._cache[_key(name)]
KeyError: 'remote.origin.pushurl'
During handling of the above exception, another exception occurred:
fuh@dell:rk3588_sdk$ python --version
Python 3.7.6
1.1 下载python2.6
下载地址:Python Source Releases
下载不了的话可以去我的资源拉取:python2.6+hashlib
1.2 安装python2.6
```shell
./configure
make
sudo make install
```
编译和安装过程可能会持续一段时间,请耐心等待。安装完成后,再次输入以下命令来验证Python 2.6的安装情况:
```shell
python2.6 --version
```
如果看到Python 2.6.x的版本号,则说明源代码安装也成功了。
fuh@dell:Python-2.6$ ls /usr/bin/python*
/usr/bin/python /usr/bin/python2.7 /usr/bin/python3-config /usr/bin/python3-pasteurize /usr/bin/python3.8
/usr/bin/python2 /usr/bin/python3 /usr/bin/python3-futurize /usr/bin/python3.10 /usr/bin/python3.8-config
fuh@dell:Python-2.6$ ls /usr/local/bin/python*
/usr/local//bin/python /usr/local//bin/python2.6 /usr/local//bin/python3 /usr/local//bin/python3.7 /usr/local//bin/python3.7m
/usr/local//bin/python-config /usr/local//bin/python2.6-config /usr/local//bin/python3-config /usr/local//bin/python3.7-config /usr/local//bin/python3.7m-config
fuh@dell:Python-2.6$ ls /usr/local/bin/python*
/usr/local/bin/python /usr/local/bin/python2.6 /usr/local/bin/python3 /usr/local/bin/python3.7 /usr/local/bin/python3.7m
/usr/local/bin/python-config /usr/local/bin/python2.6-config /usr/local/bin/python3-config /usr/local/bin/python3.7-config /usr/local/bin/python3.7m-config
fuh@dell:Python-2.6$
fuh@dell:Python-2.6$ /usr/local/bin/python2.6 --version
Python 2.6
可以看到python2.6安装到了/usr/local/bin/python2.6目录下
1.3 安装遇到问题
make过程中报错
gcc: error: directory": 没有那个文件或目录
make: *** [Modules/getbuildinfo.o] 错误 1
这里说的是svn的版本好出问题了,解决方法1.
编辑Makefile 将的SVNVERSION设置为"", 即SVNVERSION=""
参考:python3.6.6安装make报错sharedmods_ubuntu编译python源码的坑
1.4 切换python版本
安装完成后别忘了切换python版本,可以用alias命令临时用切换。alias命令可以为常用的命令设置别名。使用alias命令,可以将不同版本的Python设置为不同的命名,从而方便地切换Python版本。以下是一个使用alias命令切换Python版本的示例:
alias python2='/usr/bin/python2.7'
alias python3='/usr/bin/python3.6'
在上面的示例中,为Python2和Python3分别设置了别名。当需要使用Python2时,可以直接输入python2命令;当需要使用Python3时,可以直接输入python3命令。
fuh@dell:rk3588_sdk$ alias python='/usr/local/bin/python2.6'
fuh@dell:rk3588_sdk$ python --version
Python 2.6
二、安装hashlib
python2.6安装成功后再次更新3588 sdk代码。发现继续报错:
fuh@dell:rk3588_sdk$ .repo/repo/repo sync -l
Traceback (most recent call last):
File ".repo/repo/repo", line 134, in <module>
import urllib2
File "/usr/local/lib/python2.6/urllib2.py", line 91, in <module>
import hashlib
File "/usr/local/lib/python2.6/hashlib.py", line 138, in <module>
sha224 = __get_builtin_constructor('sha224')
File "/usr/local/lib/python2.6/hashlib.py", line 66, in __get_builtin_constructor
import _sha256
ImportError: No module named _sha256
发现是缺少hashlib,解决办法:下载安装hashlib(https://pypi.python.org/pypi/hashlib)
编译:python setup.py build
安装:python setup.py install
fuh@dell:hashlib-20081119$ sudo python setup.py install
[sudo] password for fuh:
running install
running build
running build_py
running build_ext
running install_lib
copying build/lib.linux-x86_64-2.6/_sha256.so -> /usr/local/lib/python2.6/site-packages
copying build/lib.linux-x86_64-2.6/_sha.so -> /usr/local/lib/python2.6/site-packages
copying build/lib.linux-x86_64-2.6/_sha512.so -> /usr/local/lib/python2.6/site-packages
copying build/lib.linux-x86_64-2.6/_md5.so -> /usr/local/lib/python2.6/site-packages
copying build/lib.linux-x86_64-2.6/hashlib.py -> /usr/local/lib/python2.6/site-packages
byte-compiling /usr/local/lib/python2.6/site-packages/hashlib.py to hashlib.pyc
running install_egg_info
Writing /usr/local/lib/python2.6/site-packages/hashlib-20081119-py2.6.egg-info
可以看到,安装完成后该库已经拷贝到了python2.6中。
三、更新3588 SDK代码
完成以上操作后,再次更新
fuh@dell:rk3588_sdk$ .repo/repo/repo sync -l
Updating files: 100% (13510/13510), done.
Updating files: 100% (1487/1487), done.g files: 63% (937/1487)
Updating files: 100% (272/272), done.ing files: 10% (28/272)
Updating files: 100% (275/275), done.ting files: 28% (77/275)
Updating files: 100% (2120/2120), done.ng files: 28% (603/2120)
Updating files: 100% (127/127), done.ting files: 44% (56/127)
Updating files: 100% (119/119), done.ting files: 71% (85/119)
Updating files: 100% (1037/1037), done.ng files: 21% (228/1037)
Updating files: 100% (82474/82474), done. files: 11% (9193/82474)
Updating files: 100% (5939/5939), done.ng files: 18% (1092/5939)
Updating files: 100% (5722/5722), done.ng files: 25% (1469/5722)
Updating files: 100% (262/262), done.ting files: 95% (250/262)
Updating files: 100% (36107/36107), done. files: 17% (6487/36107)
Syncing work tree: 100% (40/40), done.