码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Python · Use Tsinghua And Douban Image Source To Download Python Packages


    Hello,everyone.I am Classmate Yu.
    Today,I will tell you how to download Python Packages From Tsinghua or Douban Image Source.

    Leading-in

    First,download Python from python.org,and choose your favourite version of Python.

    (Press the download button,then choose the version.You can download the amd64 installer,it is convenient.I prefer to use version 3.7.0,because it is stable)

    And then,install Python(No Pictures)

    And… If you see the sentence which said: “Install was successful.”
    Congratulations, you have successfully installed Python.
    Now,enjoy programming!

    Use Python Packages

    We use Python Packages very often,they included Tkinter,os,random etcetera.
    You should write like this if you want to use them:

    import tkinter
    import tkinter as tk
    from tkinter import messagebox
    from tkinter import *
    """
    import + Module Name
    import + Module Name + as + New Name
    from + Module Name + import + Function Name
    """
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    But sometimes we use an not installed package,the program will report an error.

    We always use pip to solve this problem,but in China,since the Python server is too far away,we had to wait a long time for it to be installed,it is too slow

    So,that is why in China we usually use Tsinghua or Douban mirror sources,it is very fast.
    I will tell you how to use them.

    Install Python Packages

    For example,I want to use Pygame,I must install Pygame first.

    pip install pygame
    
    • 1

    Download takes a long time…
    But it is also fast,because Pygame takes up very little memory.

    If you want to use Tensorflow,you will be amazed.

    Three Hours! That is a long time.

    Then,here comes the problem,how to make it faster?
    Easy.

    You can run the following command in Windows Terminal:

    pip install tensorflow -i https://pypi.doubanio.com/simple
    
    • 1


    It is much faster!
    You can also use other mirror sources,down here:

    pip install ModuleName -i https://pypi.doubanio.com/simple #Douban Image Source
    pip install ModuleName -i https://pypi.tuna.tsinghua.edu.cn/simple #Tsinghua Image Source
    pip install ModuleName -i https://mirrors.aliyun.com/pypi/simple #AliBaba Image Source
    
    • 1
    • 2
    • 3

    If you want to use a mirror source in the future,you can write like this:

    pip config set global.index-url https://pypi.doubanio.com/simple
    
    • 1

    Cancel Settings:

    pip config unset global.index-url
    
    • 1

    OK,That’s all for this episode.
    If you like my blog, don’t forget to “Like” !
    Bye!

  • 相关阅读:
    elasticsearch7.17开发笔记
    CSDN编程挑战赛第六期—参赛心得+题解
    《ThoughtWorks现代企业架构框架白皮书》学习笔记
    uni-app使用echarts图表给图表添加点击事件/uni-app 解决echarts在h5中 tooltips及部分功能失效问题:
    一个简单HTML5期末考核大作业,学生个人html静态网页制作代码
    C语言数组越界和内存分布
    神经网络模型的训练过程,人脸识别神经网络模型
    音视频入门基础:AAC专题(6)——FFmpeg源码中解码ADTS格式的AAC的Header的实现
    深度学习实战57-pytorch框架搭建LSTM+CNN模型与实现时间序列的预测过程
    Docker环境安装OWT Server[Open WebRTC Toolkit]
  • 原文地址:https://blog.csdn.net/weixin_45122104/article/details/126195181
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号