本方法在win10下操作。
1.安装pipreqs模块
2.执行pipreqs生成requirements.txt
此处有坑,如果执行命令,直接操作所有源文件目录,则可能会失败。
建议添加import时把所有代码都删除,只留下import信息。如下。
# -*- coding: utf8 -*-
import json
import requests
import pandas as pd
import anyjson
import tushare as ts
import time
import datetime
执行pipreqs ./
3.下载所依赖的库。
pip3 install -r requirements.txt -t D:\20200101-sina_stock
centos7 安装pip+python3.6
https://www.cnblogs.com/caicaizi/p/9576424.html
[root@VM_16_4_centos ~]# history
1 2020-06-19 14:21:52
2 2020-06-19 12:23:17 python
3 2020-06-19 12:31:54 python
4 2020-06-19 12:33:04 yum install python-pip
5 2020-06-19 12:33:55 pip install --upgrade pip
6 2020-06-19 12:34:15 mkdir /usr/local/python3
7 2020-06-19 12:34:35 yum -y groupinstall "Development tools"
8 2020-06-19 12:35:14 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
9 2020-06-19 12:35:58 cd /usr/local/python3
10 2020-06-19 12:36:14 wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
11 2020-06-19 12:36:49 tar -xvf Python-3.6.2.tar.xz
12 2020-06-19 12:37:10 cd Python-3.6.2
13 2020-06-19 12:37:29 ./configure --prefix=/usr/local/python3
14 2020-06-19 12:37:54 make && make install
15 2020-06-19 12:40:27 cd /usr/bin/
16 2020-06-19 12:40:44 ls
17 2020-06-19 12:40:49 mv python python.bak
18 2020-06-19 12:41:06 mv pip pip.bak
19 2020-06-19 12:41:28 ln -s /usr/local/python3/bin/python3 /usr/bin/python
20 2020-06-19 12:41:42 ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
21 2020-06-19 12:42:12 vi /usr/bin/yum
22 2020-06-19 12:43:23 vi /usr/libexec/urlgrabber-ext-down
23 2020-06-19 12:44:09 python
24 2020-06-19 12:44:25 pip
25 2020-06-19 12:44:47 cd /root
26 2020-06-19 12:44:48 ls
27 2020-06-19 12:44:50 pwd
28 2020-06-19 13:34:59 vi reuqirements.txt
29 2020-06-19 13:38:48 ls
30 2020-06-19 13:38:55 cat reuqirements.txt
31 2020-06-19 13:40:23 pip3 install -r reuqirements.txt -t ./lib
32 2020-06-19 13:40:37 pip install -r reuqirements.txt -t ./lib
33 2020-06-19 13:40:53 pip --version
34 2020-06-19 13:42:05 pip install pipreqs
35 2020-06-19 13:42:14 pip3 install -r reuqirements.txt -t ./lib
36 2020-06-19 13:43:06 sudo apt-get install --reinstall python3-pip
37 2020-06-19 13:44:08 locate pip3
38 2020-06-19 13:46:28 ln -s /usr/local/python3/bin/pip3.6 /usr/local/bin/pip3
39 2020-06-19 13:46:38 pip3 install -r reuqirements.txt -t ./lib
40 2020-06-19 13:47:00 ls
41 2020-06-19 13:47:09 mkdir abc
42 2020-06-19 13:47:12 cd abc
43 2020-06-19 13:47:22 vi chen.py
44 2020-06-19 13:47:53 ls
45 2020-06-19 13:47:55 cd ..
46 2020-06-19 13:48:27 ls
47 2020-06-19 13:48:30 cd abc
48 2020-06-19 13:48:36 pipreqs ./
49 2020-06-19 13:49:11 pip install pipreqs
50 2020-06-19 13:49:26 pipreqs ./
51 2020-06-19 13:50:01 pipreqs ./
52 2020-06-19 13:50:54 python
53 2020-06-19 13:57:17 cd /usr/local/python3/lib/python3.6//site-packages/
54 2020-06-19 13:57:21 ls
55 2020-06-19 13:58:23 pip install --upgrade pip
56 2020-06-19 13:58:44 pipreqs /root/
57 2020-06-19 14:00:54 find / -name pipreqs
58 2020-06-19 14:01:17 cd /root
59 2020-06-19 14:01:19 ls
60 2020-06-19 14:01:24 cd abc
61 2020-06-19 14:01:25 ls
62 2020-06-19 14:01:49 /usr/local/python3/bin/pipreqs ./
63 2020-06-19 14:02:12 vi chen.py
64 2020-06-19 14:02:34 /usr/local/python3/bin/pipreqs ./
65 2020-06-19 14:02:48 ls
66 2020-06-19 14:03:07 mkdir e2345
67 2020-06-19 14:03:36 pip3 install -r requirements.txt -t ./e2345/
68 2020-06-19 14:03:50 ls
69 2020-06-19 14:04:06 du -sh *
70 2020-06-19 14:23:52 /usr/local/python3/bin/pipreqs ./
71 2020-06-19 14:24:22 pip3 install -r requirements.txt -t ./e2345/