在迁移别人写好的脚本时,发现pychartdir
没有导入,脚本执行报错。以下是报错内容:
[modps@LGJF-ZYC5-MMSC-WEB02 ~]$ python /opt/aspire/product/modps/mopps/shell/dayreport_linux.py /etc/host.conf: line 1: bad command `nospoof on' Traceback (most recent call last): File "/opt/aspire/product/modps/mopps/shell/dayreport_linux.py", line 42, in <module> from pychartdir import * ImportError: No module named pychartdir
之前使用的是pip
来安装模块的,先安装下pip:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python get-pip.py
然后开始下载pychartdir模块:
[root@LGJF-ZYC5-MMSC-WEB02 ~]# pip install pychartdir DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality. /etc/host.conf: line 1: bad command `nospoof on' ERROR: Could not find a version that satisfies the requirement pychartdir (from versions: none) ERROR: No matching distribution found for pychartdir
发现报错了,报错的大概意思为:未找到合适的版本。
那么就只好手动安装了
1.从官方地址下载python版本的ChartDirector并解压
https://www.advsofteng.com/download.html # 使用lrzsz命令将下载的包传递到服务器上 [root@LGJF-ZYC5-MMSC-WEB02 ~]# tar -xf chartdir_python_linux_64.tar.gz
2.在python模块安装目录下(/usr/lib/python2.7/site-packages)创建一个chartdirector的目录
# 查看模块安装目录 [root@LGJF-ZYC5-MMSC-WEB02 ~]# python Python 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)] on linux2 Type "help", "copyright", "credits" or "license" for more information. > import sys > print(sys.path) ['', '/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages'] > [root@LGJF-ZYC5-MMSC-WEB02 ~]# cd /usr/lib/python2.7/site-packages [root@LGJF-ZYC5-MMSC-WEB02 site-packages]# mkdir chartdirector [root@LGJF-ZYC5-MMSC-WEB02 site-packages]# cd chartdirector [root@LGJF-ZYC5-MMSC-WEB02 chartdirector]# pwd /usr/lib/python2.7/site-packages/chartdirector
3.进入解压好的Chartdirector/ lib,将其下面的内容拷贝到上边创建的目录下,同时在site-packages
下创建一个chartdirector.pth
,写入chartdirector到文件中:
[root@LGJF-ZYC5-MMSC-WEB02 chartdirector]# cd [root@LGJF-ZYC5-MMSC-WEB02 ~]# cd ChartDirector/lib/ [root@LGJF-ZYC5-MMSC-WEB02 lib]# cp -a ./* /usr/lib/python2.7/site-packages/chartdirector/ [root@LGJF-ZYC5-MMSC-WEB02 lib]# cd /usr/lib/python2.7/site-packages/ [root@LGJF-ZYC5-MMSC-WEB02 site-packages]# cat chartdirector.pth chartdirector
4.打开python IDE,导入该模块试试:
[root@LGJF-ZYC5-MMSC-WEB02 site-packages]# python Python 2.7.5 (default, May 3 2017, 07:55:04) [GCC 4.8.5 20150623 (Red Hat 4.8.5-14)] on linux2 Type "help", "copyright", "credits" or "license" for more information. > import pychartdir
5.运行脚本,执行成功!
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
暂无评论...
更新日志
2024年12月25日
2024年12月25日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]