解决方法在中间
输入代码:
1 2 | pip freeze > requirements.txt 生成requirements.txt文件 |
下面我演示一下:
图一: (可以看到这就是一个普通的项目)

图二: (在命令行输入代码 pip freeze > requirements.txt )

图三: (可以看到生成了 requirements.txt文件,
linux也是这样的,只不过是在终端输入上面的代码。
)
windows里面的操作
linux里面的操作

点开 requirements.txt文件,里面的内容就是这个项目用到的一些包啊,库什么的,还有一些不认识是什么东西的。
内容有点多,在下面。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | alabaster==0.7.12 anaconda-client==1.7.2 anaconda-navigator==1.9.12 anaconda-project==0.8.3 argh==0.26.2 asn1crypto==1.3.0 astroid==2.3.3 astropy==4.0 atomicwrites==1.3.0 attrs==19.3.0 autopep8==1.4.4 Babel==2.8.0 backcall==0.1.0 backports.functools-lru-cache==1.6.1 backports.shutil-get-terminal-size==1.0.0 backports.tempfile==1.0 backports.weakref==1.0.post1 bcrypt==3.1.7 beautifulsoup4==4.8.2 bitarray==1.2.1 bkcharts==0.2 bleach==3.1.0 bokeh==1.4.0 boto==2.49.0 Bottleneck==1.3.2 certifi==2019.11.28 cffi==1.14.0 chardet==3.0.4 Click==7.0 cloudpickle==1.3.0 clyent==1.2.2 colorama==0.4.3 comtypes==1.1.7 conda==4.8.5 conda-build==3.18.11 conda-package-handling==1.6.0 conda-verify==3.4.2 contextlib2==0.6.0.post1 cryptography==2.8 cycler==0.10.0 Cython==0.29.15 cytoolz==0.10.1 dask==2.11.0 decorator==4.4.1 defusedxml==0.6.0 diff-match-patch==20181111 distributed==2.11.0 Django==2.2.5 django-redis==4.12.1 django-redis-cache==2.1.3 docutils==0.16 entrypoints==0.3 et-xmlfile==1.0.1 fastcache==1.1.0 filelock==3.0.12 flake8==3.7.9 Flask==1.1.1 fsspec==0.6.2 future==0.18.2 gevent==1.4.0 glob2==0.7 greenlet==0.4.15 h5py==2.10.0 HeapDict==1.0.1 html5lib==1.0.1 hypothesis==5.5.4 idna==2.8 imageio==2.6.1 imagesize==1.2.0 importlib-metadata==1.5.0 intervaltree==3.0.2 ipykernel==5.1.4 ipython==7.12.0 ipython-genutils==0.2.0 ipywidgets==7.5.1 isort==4.3.21 itsdangerous==1.1.0 jedi==0.14.1 Jinja2==2.11.1 joblib==0.14.1 json5==0.9.1 jsonschema==3.2.0 jupyter==1.0.0 jupyter-client==5.3.4 jupyter-console==6.1.0 jupyter-core==4.6.1 jupyterlab==1.2.6 jupyterlab-server==1.0.6 keyring==21.1.0 kiwisolver==1.1.0 lazy-object-proxy==1.4.3 libarchive-c==2.8 llvmlite==0.31.0 locket==0.2.0 lxml==4.5.0 MarkupSafe==1.1.1 matplotlib==3.1.3 mccabe==0.6.1 menuinst==1.4.16 mistune==0.8.4 mkl-fft==1.0.15 mkl-random==1.1.0 mkl-service==2.3.0 mock==4.0.1 more-itertools==8.2.0 mpmath==1.1.0 msgpack==0.6.1 multipledispatch==0.6.0 mysql==0.0.2 mysql-connector==2.2.9 mysql-connector-repackaged==0.3.1 mysqlclient==2.0.1 navigator-updater==0.2.1 nbconvert==5.6.1 nbformat==5.0.4 networkx==2.4 nltk==3.4.5 nose==1.3.7 notebook==6.0.3 numba==0.48.0 numexpr==2.7.1 numpy==1.18.1 numpydoc==0.9.2 olefile==0.46 openpyxl==3.0.3 packaging==20.1 pandas==1.0.1 pandocfilters==1.4.2 paramiko==2.7.1 parso==0.5.2 partd==1.1.0 path==13.1.0 pathlib2==2.3.5 pathtools==0.1.2 patsy==0.5.1 pep8==1.7.1 pexpect==4.8.0 pickleshare==0.7.5 Pillow==7.0.0 pkginfo==1.5.0.1 pluggy==0.13.1 ply==3.11 prometheus-client==0.7.1 prompt-toolkit==3.0.3 psutil==5.6.7 py==1.8.1 pycodestyle==2.5.0 pycosat==0.6.3 pycparser==2.19 pycrypto==2.6.1 pycurl==7.43.0.5 pydocstyle==4.0.1 pyflakes==2.1.1 Pygments==2.5.2 pylint==2.4.4 PyMySQL==0.10.1 PyNaCl==1.3.0 pyodbc===4.0.0-unsupported pyOpenSSL==19.1.0 pyparsing==2.4.6 pyreadline==2.1 pyrsistent==0.15.7 PySocks==1.7.1 pytest==5.3.5 pytest-arraydiff==0.3 pytest-astropy==0.8.0 pytest-astropy-header==0.1.2 pytest-doctestplus==0.5.0 pytest-openfiles==0.4.0 pytest-remotedata==0.3.2 python-dateutil==2.8.1 python-jsonrpc-server==0.3.4 python-language-server==0.31.7 pytz==2019.3 PyWavelets==1.1.1 pywin32==227 pywin32-ctypes==0.2.0 pywinpty==0.5.7 PyYAML==5.3 pyzmq==18.1.1 QDarkStyle==2.8 QtAwesome==0.6.1 qtconsole==4.6.0 QtPy==1.9.0 redis==3.5.3 requests==2.22.0 rope==0.16.0 Rtree==0.9.3 ruamel-yaml==0.15.87 scikit-image==0.16.2 scikit-learn==0.22.1 scipy==1.4.1 seaborn==0.10.0 Send2Trash==1.5.0 simplegeneric==0.8.1 singledispatch==3.4.0.3 six==1.14.0 snowballstemmer==2.0.0 sortedcollections==1.1.2 sortedcontainers==2.1.0 soupsieve==1.9.5 Sphinx==2.4.0 sphinxcontrib-applehelp==1.0.1 sphinxcontrib-devhelp==1.0.1 sphinxcontrib-htmlhelp==1.0.2 sphinxcontrib-jsmath==1.0.1 sphinxcontrib-qthelp==1.0.2 sphinxcontrib-serializinghtml==1.1.3 sphinxcontrib-websupport==1.2.0 spyder==4.0.1 spyder-kernels==1.8.1 SQLAlchemy==1.3.13 sqlparse==0.3.1 statsmodels==0.11.0 sympy==1.5.1 tables==3.6.1 tblib==1.6.0 terminado==0.8.3 testpath==0.4.4 toolz==0.10.0 tornado==6.0.3 tqdm==4.42.1 traitlets==4.3.3 ujson==1.35 unicodecsv==0.14.1 urllib3==1.25.8 watchdog==0.10.2 wcwidth==0.1.8 webencodings==0.5.1 Werkzeug==1.0.0 widgetsnbextension==3.5.1 win-inet-pton==1.1.0 win-unicode-console==0.5 wincertstore==0.2 wrapt==1.11.2 xlrd==1.2.0 XlsxWriter==1.2.7 xlwings==0.17.1 xlwt==1.3.0 xmltodict==0.12.0 yapf==0.28.0 zict==1.0.0 zipp==2.2.0 |
接下来就是安装这些玩意了。
输入代码:
1 2 3 4 | pip install -i https://pypi.doubanio.com/simple/ -r requirements.txt (因为直接输入pip install -r requirements.txt 下载太慢,还容易出错 也可以用清华的镜像网站,阿里的镜像网站啊什么的,都行。 ) |
输入之后回车,就开始下载 文件requirements.txt里面的内容 这些玩意了。
整下载这呢,突然报了个错。
哎?怎么回事?
这个错误上面可能还会跟着一个警告(python)
上面这个不用管它。
下面这个错误,其实就是对应版本的包在网站上面找不到(也可能是网络问题)
可以换一个版本的包,或者直接把它在requirements.txt里面删了(doge),其实有些包确实基本上用不到。
这个时候输入代码:
1 2 3 | vim requirements.txt 回车, 就进入了requirements.txt文件(下面我放了实践的图片) |

点击键盘的 i 键,就可以修改文件了
比如报了错
可以修改asgiref==3.1.10,或者直接给它删了(就是把第一行删了),眼不见心不烦。
然后点击 Esc 键, 输入 :wq (英文分号+w + q,是保存退出的意思,这是linux的操作)
然后回车就行了
再次输入代码:
1 | pip install -i https://pypi.doubanio.com/simple/ -r requirements.txt |
回车继续下载,放心吧,下载一会还会出现相似的错误(总会有一些包有毛病下载不了)
或者是另一种形式的错误(本来想截图的,一不小心给叉了。。。,那就这样吧,我直接vim requirements.txt
进去那个错就把那个删了,反正也用不到(我删的的确是我用不到的,你们我就不晓得了)。)
出了错就重复我上面的操作,就行了。
在网上搜了一个晚上也没找到怎么解决,或者是描述不清楚,根本不明白描述的什么意思,于是我就写了这篇博客。其实在外国的网站上(stack floow什么的,忘记了)看到了也有一个人问这个问题,别人给他解答了,奈何都是英文,看也看不懂。。。
希望能帮助到大家。
上面这些东西,我已经尽我所能的描述了,如果你出现了我所说的这些错误,然后你又看不懂我写的是什么玩意,直接是私信老夫就行了。
对了,我有个朋友,熬夜猝死前想看到我涨到500粉丝,嗯,就是这样,没事了。