python常见错误解决方法

注意:在使用别人写的代码之前,一定先查看版本是否对应;

用以下语句修改版本:

pip install --upgrade keras==2.1.0 #升级到指定版本
pip install  keras==2.0.9  #安装指定版本
 

 

1.ModuleNotFoundError: No module named 'XXX'

显示没有这个模块,先用pip uninstall xxx,  再用 pip install xxx

2.ModuleNotFoundError: No module named 'pip._internal'

root@iZwz98p61dhjsadfhjkarjhj5Z:~# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate root@iZwz98p61dhjsadfhjkarjhj5Z:~# sudo python get-pip.py

3.NameError: name 'unicode' is not defined

There is no such name in Python 3, no. You are trying to run Python 2 code in Python 3. In Python 3, unicode has been renamed to str.

简单来说就是: Python2 的unicode 函数在 Python3 中被命名为 str。在 Python3 中使用 ·str 来代替 Python2 中的 unicode.

4.安装python3-tk问题

直接pip 是不行的,我输入的是下面一行命令

sudo apt-get install python3-tk, 问题就解决了。。。

5.出现这句话的情况:Command "python setup.py egg_info" failed 

执行如下命令:pip install --upgrade setuptools

你可能感兴趣的:(python软件,python)