Package ‘python3-tk‘ has no installation candidate

  1. 安装tensorflow-gpu:

    pip install --upgrade tensorflow

    #可设定下载地址为国内镜像,具体方法如下

    # 清华源,不怎么稳定
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    # 阿里源,相对较好
    pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
    # 腾讯源
    pip config set global.index-url http://mirrors.cloud.tencent.com/pypi/simple
    # 豆瓣源
    pip config set global.index-url http://pypi.douban.com/simple/
  2. 问题:Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0

    #解决方法:

    ln -snf /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0 /usr/lib/x86_64-linux-gnu/libcudart.so.11.0

  3. vim操作问题:
    #1.定位到指定行:55gg:定位到55行
    #2.定位到文件开头:gg
    #3.定位到文件结尾:shift+g
    #4.定位到某个单词:shift+*,快速选中该单词,通过n或者N进行下一个匹配
  4. 查看所有python版本
    cd /usr/bin   //进入目录
    ls | grep python   //会列出当前系统中的所有python版本
    #将python3软链接到python3.6:
    ln -snf python3.6 python3
  5. Package 'python3-tk' has no installation candidate

    sudo apt-get update
    sudo apt-get install python3-tk
    
    apt search python3-tk #查看所有的相关包
    
    #最终解决方法:
    apt-get install python3.6-tk
    
    #解决思路:
    apt-cache search tkinter #该命令列出所有的可满足tkinter的包,发现有3.6专属的包,被python3-tk误导了,简直有毒
  6. tqdm

    Tqdm 是一个快速,可扩展的Python进度条,可以在Python 长循环中添加一个进度提示信息,用户只需要封装任意的迭代器tqdm(iterator)。 总之,它是用来显示进度条的,很漂亮,使用很直观(在循环体里边加个tqdm),而且基本不影响原程序效率。

  7. ModuleNotFoundError: No module named 'tensorflow.contrib'

    问题原因:contrib在tensorflow2.0中已经被移除了

    解决方法:
    contrib的功能已经集成到其他模块中,改代码吧:
    import tensorflow.keras.layers as layers
     
    如何描述一个问题:
  8. 问题:AttributeError: module 'tensorflow' has no attribute 'app'
    解决方法:import tensorflow.compat.v1 as tf
  9. Resource punkt not found. Please use the NLTK Downloader to obtain the resource

    1. nltk:自然语言处理包

  10. allow_pickle问题:
    data_dict = np.load(save_path, allow_pickle=True).item()
    data_dict = np.load(save_path,).item()
     
    allow_pickle: 可选,布尔值,允许使用 Python pickles 保存对象数组,Python 中的 pickle 用于在保存到磁盘文件或从磁盘文件读取之前,对对象进行序列化和反序列化。
原文地址:https://www.cnblogs.com/maggie94/p/14538331.html