numpy==1.19.0 #anaconda自带了,但需要升级
matplotlib==3.0.3 #anaconda自带了
scikit-learn==0.20.3 #anaconda自带了
pyqt5==5.9.2 #anaconda自带了
jupyter==1.0.0 #anaconda自带了
pygame==1.9.6
opencv-python==3.4.6.27
opencv-python==3.4.10.35
opencv-python==4.3.0.36
kociemba==1.2.1
serial==0.0.97
pyopengl==3.1.5
wxpython==4.0.7
itchat==1.3.10
#torch==1.4.0
torchvision==0.5.0 #会先下载torch==1.4.0的
#torch==1.5.0
torchvision==0.6.0 #会先下载torch==1.5.0的
#torch==1.6.0
torchvision==0.7.0 #会先下载torch==1.6.0的
keras==2.3.1
tensorflow-gpu==1.14.0
tensorflow-gpu==2.0.0
eventlet==0.25.1
python-socketio==4.6.0
imgaug==0.4.0
dlib==19.20.0
pyecharts==1.8.1
easydict==1.9
tensorboardX==2.1
visdom==0.1.8.9
onnxruntime==1.4.0
onnxruntime-gpu==1.4.0
tf2onnx==1.6.3 #会先下载onnx==1.7.0的
onnx_tf==1.5.0 #会先下载onnx==1.7.0的
cython==0.29.21
pycuda==2019.1.1
#ubuntu16.04
cd /home/liuhao/PycharmProjects/Python_3rdparty/
source ~/anaconda3/bin/activate mybase_python3.7.3
pip download numpy==1.19.0 -d ./numpy/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download matplotlib==3.0.3 -d ./matplotlib/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download scikit-learn==0.20.3 -d ./scikit-learn/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download pyqt5==5.9.2 -d ./pyqt5/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download jupyter==1.0.0 -d ./jupyter/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download pygame==1.9.6 -d ./pygame/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download opencv-python==3.4.6.27 -d ./opencv-python3.4.6/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download opencv-python==3.4.10.35 -d ./opencv-python3.4.10/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download opencv-python==4.3.0.36 -d ./opencv-python4.3.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download kociemba==1.2.1 -d ./kociemba/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download serial==0.0.97 -d ./serial/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download pyopengl==3.1.5 -d ./pyopengl/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download wxpython==4.0.7 -d ./wxpython/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download itchat==1.3.10 -d ./itchat/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download torchvision==0.5.0 -d ./torchvision0.5.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download torchvision==0.6.0 -d ./torchvision0.6.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download torchvision==0.7.0 -d ./torchvision0.7.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download keras==2.3.1 -d ./keras2.3.1/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download tensorflow-gpu==1.14.0 -d ./tensorflow-gpu1.14.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download tensorflow-gpu==2.0.0 -d ./tensorflow-gpu2.0.0/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download eventlet==0.25.1 -d ./eventlet/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download python-socketio==4.6.0 -d ./python-socketio/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download imgaug==0.4.0 -d ./imgaug/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download dlib==19.20.0 -d ./dlib/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download pyecharts==1.8.1 -d ./pyecharts/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download easydict==1.9 -d ./easydict/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download tensorboardX==2.1 -d ./tensorboardX/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download visdom==0.1.8.9 -d ./visdom/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download onnxruntime==1.4.0 -d ./onnxruntime/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download onnxruntime-gpu==1.4.0 -d ./onnxruntime-gpu/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download tf2onnx==1.6.3 -d ./tf2onnx/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download onnx_tf==1.5.0 -d ./onnx_tf/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#==================================================================================
pip download cython==0.29.21 -d ./cython/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip download pycuda==2019.1.1 -d ./pycuda/ -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
#用pip wheel把.tar.gz文件生成.whl文件,在/home/liuhao/.cache/pip/wheels/
#可能需要联网才能完成-i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip wheel ./<自定义路径>/<具体文件名>.tar.gz
pip install ./<自定义路径>/*.whl #ubuntu可用,但windows不可用
#安装到mybase_python3.7.3环境中,依次执行下面命令
pip install ./numpy/*.whl #无.tar.gz文件
pip install ./pygame/*.whl #无.tar.gz文件
pip install ./opencv-python3.4.6/*.whl #无.tar.gz文件
pip install ./kociemba/*.whl #有.tar.gz文件,需要转换为.whl文件
pip install ./serial/*.whl #有.tar.gz文件,需要转换为.whl文件 #需要把PyYAML移到另一个地方
pip install ./pyopengl/*.whl #无.tar.gz文件
pip install ./wxpython/*.whl #有.tar.gz文件,需要转换为.whl文件
pip install ./itchat/* #有.tar.gz文件,不用手动转换为.whl文件,否则安装不了 #需要把certifi移到另一个地方
pip install ./torchvision0.5.0/*.whl #无.tar.gz文件
pip install ./torchvision0.6.0/*.whl #有.tar.gz文件
pip install ./torchvision0.7.0/*.whl #有.tar.gz文件
pip install ./keras2.3.1/*.whl #有.tar.gz文件,需要转换为.whl文件#需要把PyYAML移到另一个地方
pip install ./tensorflow-gpu1.14.0/*.whl #有.tar.gz文件,需要转换为.whl文件
pip install ./tensorflow-gpu2.0.0/*.whl #有.tar.gz文件,需要转换为.whl文件 #需要把certifi移到另一个地方
pip install ./eventlet/*whl #无.tar.gz文件
pip install ./python-socketio/*whl #无.tar.gz文件
pip install ./imgaug/*.whl #无.tar.gz文件,需要把imageio和opencv_python-4.3.0移到另一个地方
pip install ./dlib/dlib-19.20.0.tar.gz
pip install ./pyecharts/*.whl ./pyecharts/*.tar.bz2
pip install ./easydict/easydict-1.9.tar.gz
pip install ./tensorboardX/*.whl
pip install ./visdom/*.whl ./visdom/torchfile-0.1.0.tar.gz ./visdom/tornado-6.0.4.tar.gz ./visdom/visdom-0.1.8.9.tar.gz #需要把certifi移到另一个地方
pip install ./tf2onnx/*.whl #需要把certifi移到另一个地方
pip install ./onnx_tf/*.whl
pip install ./cython/*.whl
#第一次要拷贝pytools-2020.3.1-py2.py3-none-any.whl到./pycuda/,才完全无网安装
pip install ./pycuda/*.whl ./pycuda/pycuda-2019.1.1.tar.gz
#在mybase_python3.7.3看不出来,要在新环境test_python3.7.3才能看出来
#windows10
d:
cd /AI_robot/Heima_Project/Clion_and_Pycharm/Python_3rdparty/
activate mybase_python3.7.3
#跟ubuntu16.04的pip download一样
#用pip wheel把.tar.gz文件生成.whl文件,在C:\Users\liuhao\AppData\Local\pip\cache\wheels\
#可能需要联网才能完成-i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip wheel ./<自定义路径>/<具体文件名>.tar.gz
#pip_install.txt里面最好只放.whl文件名称
pip install -r ./<自定义路径>/pip_install.txt #ubuntu可用,windows可用
获取各个文件夹下面的文件名,并加上所在文件夹名,保存在对应文件夹下面的pip_install.txt中
import os
directoryPath = "D:/AI_robot/Heima_Project/Clion_and_Pycharm/Python_3rdparty/"
subdirectoryPath = ["numpy", "pygame", "opencv-python3.4.6", "opencv-python3.4.10", "opencv-python4.3.0", "kociemba", "serial", "pyopengl", "wxpython", "itchat",
"torchvision0.4.0", "torchvision0.6.0", "keras2.3.1", "tensorflow-gpu1.14.0", "tensorflow-gpu2.0.0", "eventlet", "python-socketio", "imgaug"]
for ele in subdirectoryPath:
filename = os.listdir(directoryPath + ele)
# 生成并打开文件
fd = os.open(directoryPath + ele + "/" + "pip_install.txt", os.O_RDWR | os.O_CREAT, os.O_APPEND)
for ele2 in filename:
print(ele + "\\" + ele2)
# # 写入字符串
ret = os.write(fd, (ele + "\\" + ele2 + "\t\n").encode())
os.close(fd)
然后依次执行下面命令
#安装到mybase_python3.7.3环境中,依次执行下面命令
pip install -r ./numpy/pip_install.txt #无.tar.gz文件
pip install -r ./pygame/pip_install.txt #无.tar.gz文件
pip install -r ./opencv-python3.4.6/pip_install.txt #无.tar.gz文件
pip install -r ./kociemba/pip_install2.txt #有.tar.gz文件,需要转换为.whl文件 #需要把.tar.gz去掉,用pip_install2.txt就可以了
pip install -r ./serial/pip_install2.txt #有.tar.gz文件,需要转换为.whl文件 #需要把.tar.gz和PyYAML-5.3.1-cp37-cp37m-win_amd64.whl去掉,用pip_install2.txt就可以了
pip install -r ./pyopengl/pip_install.txt #无.tar.gz文件
pip install -r ./wxpython/pip_install.txt #无.tar.gz文件
pip install -r ./itchat/pip_install2.txt #有.tar.gz文件,不用手动转换为.whl文件,否则安装不了 #需要把certifi-2020.6.20-py2.py3-none-any.whl去掉,用pip_install2.txt就可以了
pip install -r ./torchvision0.4.0/pip_install.txt#豆瓣镜像源没有找到指定版本,用pytorch官网
torchvision0.4.1
torchvision0.5.0
pip install -r ./torchvision0.6.0/pip_install.txt#豆瓣镜像源没有找到指定版本,用pytorch官网
pip install -r ./keras2.3.1/pip_install2.txt #无.tar.gz文件,#需要把PyYAML-5.3.1-cp37-cp37m-win_amd64.whl去掉,用pip_install2.txt就可以了
pip install -r ./tensorflow-gpu1.14.0/pip_install.txt
pip install -r ./tensorflow-gpu2.0.0/pip_install2.txt #有.tar.gz文件,需要转换为.whl文件 #需要把.tar.gz和certifi-2020.6.20-py2.py3-none-any.whl去掉,用pip_install2.txt就可以了
pip install -r ./eventlet/pip_install.txt #无.tar.gz文件
pip install -r ./python-socketio/pip_install.txt #无.tar.gz文件
pip install -r ./imgaug/pip_install2.txt#无.tar.gz文件,移除imageio和opencv_python-4.3.0
如果卡住不动,可以按ctrl+z跳过,继续下面的安装
#在mybase_python3.7.3看不出来,要在新环境test_python3.7.3才能看出来
import sys
print("当前操作系统类型:", sys.platform)
print("Python解释器在磁盘上的存储路径:", sys.executable)
print("Python解释器的版本信息 :", sys.version)
print("Python解释器的版本信息 :", sys.version_info)
# for index, sys_path in enumerate(sys.path):
# print("sys系统路径:", index, sys_path)
# print(sys.base_exec_prefix)
# print(sys.base_prefix)
# print(sys.exec_prefix)
# print(sys.prefix)
flag1 = True
flag2 = True
flag3 = True
flag4 = True
flag5 = True
flag6 = True
# # ==========================================================================
import certifi # (anaconda3自带了,2019.03.09)
import pip # (anaconda3自带了,19.0.3)
# import setuptools # (anaconda3自带了,47.3.1)
import wheel # (anaconda3自带了,0.34.2)
if (flag1):
print("{}版本号:{}".format(certifi.__name__, certifi.__version__))
print("{}版本号:{}".format(certifi.__name__, certifi.__file__))
print("{}版本号:{}".format(pip.__name__, pip.__version__))
print("{}版本号:{}".format(pip.__name__, pip.__file__))
# print("{}版本号:{}".format(setuptools.__name__, setuptools.__version__))
# print("{}版本号:{}".format(setuptools.__name__, setuptools.__file__))
print("{}版本号:{}".format(wheel.__name__, wheel.__version__))
print("{}版本号:{}".format(wheel.__name__, wheel.__file__))
# ==========================================================================
# import Pillow
import PIL # (anaconda3自带了,7.2.0)
# import PyYAML
import yaml # (anaconda3自带了,5.1)
import scipy # (anaconda3自带了,1.5.0)
import seaborn # (anaconda3自带了,0.9.0)
import six # (anaconda3自带了,1.15.0)
import urllib # (anaconda3自带了,)
import urllib3 # (anaconda3自带了,1.25.9)
import re # (anaconda3自带了,2.2.1)
import requests # (anaconda3自带了,2.24.0)
# import python-dateutil
import dateutil # (anaconda3自带了,2.8.0)
import numpy # (anaconda3自带了,1.16.2) pip install numpy
import matplotlib # (anaconda3自带了,3.0.3) pip install matplotlib
import sklearn # (anaconda3自带了,0.20.3) pip install scikit-learn
import pandas # (anaconda3自带了,0.24.2) pip install pandas
import PyQt5 # (anaconda3自带了,5.9.2) pip install PyQt5
import PyQt5.Qt
import PyQt5.QtCore
import jupyter # (anaconda3自带了,1.0.0) pip install jupyter==1.0.0
import jupyter_client
import jupyter_console
import jupyter_core
if (flag2):
for ele in PIL, yaml, scipy, seaborn, six, urllib3, re, requests, dateutil, numpy, matplotlib, sklearn, pandas:
print("{}版本号:{}".format(ele.__name__, ele.__version__))
print("{}版本号:{}".format(ele.__name__, ele.__file__))
# print("{}版本号:{}".format(urllib.__name__, urllib.__version__))
print("{}版本号:{}".format(urllib.__name__, urllib.__file__))
# print("{}版本号:{}".format(PyQt5.__name__, PyQt5.__version__))
print("{}版本号:{}".format(PyQt5.__name__, PyQt5.__file__))
print("PyQt5版本号\t\t:", PyQt5.Qt.QT_VERSION_STR)
print("PyQt5版本号\t\t:", PyQt5.Qt.PYQT_VERSION_STR)
print("PyQt5版本号\t\t:", PyQt5.QtCore.QT_VERSION_STR)
print("PyQt5版本号\t\t:", PyQt5.QtCore.PYQT_VERSION_STR)
# print("{}版本号:{}".format(jupyter.__name__, jupyter.__version__))
print("{}版本号:{}".format(jupyter.__name__, jupyter.__file__))
print("{}版本号:{}".format(jupyter_core.__name__, jupyter_core.__version__))
print("{}版本号:{}".format(jupyter_core.__name__, jupyter_core.__file__))
print("{}版本号:{}".format(jupyter_client.__name__, jupyter_client.__version__))
print("{}版本号:{}".format(jupyter_client.__name__, jupyter_client.__file__))
# ==========================================================================
import pygame # pip install pygame==1.9.6 -i http://pypi.douban.com/simple
import cv2 # pip install opencv-python==3.4.6.27 -i http://pypi.douban.com/simple
import kociemba # pip install kociemba==1.2.1 -i http://pypi.douban.com/simple
import serial # pip install serial==0.0.97 -i http://pypi.douban.com/simple
import OpenGL # pip install PyOpenGL==3.1.5 -i http://pypi.douban.com/simple
import OpenGL.GL
import OpenGL.GLU
import OpenGL.GLUT
# windows系统下,安装方法
# pip install wxPython==4.0.7 -i http://pypi.douban.com/simple
# ubuntu16.04系统下,安装方法
# pip install wxPython==4.0.7 -i http://pypi.douban.com/simple
# pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython==4.0.7.post2
import wx
import itchat # pip install itchat==1.3.10 -i http://pypi.douban.com/simple
# 第一个cv2代表cv2文件夹
# 第二个cv2代表cv2.cpython-37m-x86_64-linux-gnu.so文件
print("库名称:", cv2.__name__) # cv2.cv2
if (flag3):
for ele in pygame, cv2, OpenGL, wx, itchat:
print("{}版本号:{}".format(ele.__name__, ele.__version__))
print("{}版本号:{}".format(ele.__name__, ele.__file__))
# print("{}版本号:{}".format(kociemba.__name__, kociemba.__version__))
print("{}版本号:{}".format(kociemba.__name__, kociemba.__file__))
# print("{}版本号:{}".format(serial.__name__, serial.__version__))
print("{}版本号:{}".format(serial.__name__, serial.__file__))
print("{}版本号:{}".format(OpenGL.__name__, OpenGL.GL.__file__))
print("{}版本号:{}".format(OpenGL.__name__, OpenGL.GLU.__file__))
print("{}版本号:{}".format(OpenGL.__name__, OpenGL.GLUT.__file__))
# ===========================================================================
# import pytorch # 没有这种导包方式,应该用import torch
import torch
import torchvision # 会先安装torch==1.2.0的
# pytorch官网的命令安装不了,采用下面方式
# pip install torch==1.2.0 -i http://pypi.douban.com/simple
# pip install torchvision==0.4.0 -i http://pypi.douban.com/simple
import keras # pip install keras==2.3.1 -i http://pypi.douban.com/simple
# # tensorflow keras 尽量版本匹配,比较好
# import tensorflow as tf # pip install tensorflow==2.0.0 -i http://pypi.douban.com/simple
import tensorflow as tf # pip install tensorflow-gpu==2.0.0 -i http://pypi.douban.com/simple
import tensorboard
import tensorflow_core
import tensorflow_estimator
if (flag4):
for ele in torch, torchvision, keras, tf, tensorboard, tensorflow_core:
print("{}版本号:{}".format(ele.__name__, ele.__version__))
print("{}版本号:{}".format(ele.__name__, ele.__file__))
# print("{}版本号:{}".format(tensorflow_estimator.__name__, tensorflow_estimator.__version__))
print("{}版本号:{}".format(tensorflow_estimator.__name__, tensorflow_estimator.__file__))
# ==========================================================================
# 搜索版本
# pip search opencv-python (pip install opencv-python==3.4.6会提示有哪些版本)
# pip search tensorflow
# pip search tensorflow-gpu
# pip search tensorflow-cpu
# pip search keras
# pip search keras-gpu #没有keras-gpu
# pip search torch
# pip search torch-gpu #没有torch-gpu
# 查看版本,位置,依赖等信息
# pip show opencv-python
# pip show tensorflow
# pip show tensorflow-gpu
# pip show keras
# pip show torch
# #检查gpu是否可以使用
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
print("tf gpu:", tf.test.is_gpu_available()) # 不会输出日志
# print("keras gpu:",keras.test.is_gpu_available()) #keras没有找到对应api
# print("keras gpu:",keras.cuda.is_available())
print("torch gpu:", torch.cuda.is_available())
# 在pycharm中运行就会报Using TensorFlow backend.提示
# 在jupyter-notebook第一次会报Using TensorFlow backend.提示,第二次运行就好了
# ==========================================================================
import flask # (anaconda3自带了,7.2.0)
import eventlet
import socketio
import imgaug
if (flag5):
for ele in flask, eventlet, socketio, imgaug:
print("{}版本号:{}".format(ele.__name__, ele.__version__))
print("{}版本号:{}".format(ele.__name__, ele.__file__))
# ==========================================================================
import dlib
import pyecharts
import easydict
import tensorboardX
import visdom
import cython
import pycuda
if (flag6):
for ele in dlib, pyecharts, tensorboardX, visdom, cython:
print("{}版本号:{}".format(ele.__name__, ele.__version__))
print("{}版本号:{}".format(ele.__name__, ele.__file__))
print("{}版本号:{}".format(pycuda.__name__, pycuda.VERSION))
print("{}版本号:{}".format(pycuda.__name__, pycuda.__file__))
# print("{}版本号:{}".format(easydict.__name__, easydict.__version__))
print("{}版本号:{}".format(easydict.__name__, easydict.__file__))
# # # ==========================================================================
# # 这几个库跟上面的一些有冲突,需要单独测试
# import onnx
# import onnxruntime
# import tf2onnx
# import onnx_tf # 这个在tf2.0上会报错,在tf1.14.0上不会报错
#
# for ele in onnx, onnxruntime, tf2onnx:
# print("{}版本号:{}".format(ele.__name__, ele.__version__))
# print("{}版本号:{}".format(ele.__name__, ele.__file__))
#
# # print("{}版本号:{}".format(onnx_tf.__name__, onnx_tf.__version__))
# print("{}版本号:{}".format(onnx_tf.__name__, onnx_tf.__file__))
# # ==========================================================================