pip 安装依赖 设置加速目录 Conda 设置加速安装
python 设置阿里云pip源,加速pip更新速度
Linux系统:
mkdir ~/.pip
cat > ~/.pip/pip.conf << EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
EOF
Windows系统:
首先在window的文件夹窗口输入 : %APPDATA%
然后创建pip文件夹
最后创建pip.ini文件,写入如下内容:
[global]
index-url = https://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
pip 安装依赖 设置加速 http://www.zyglz.com/index.php/archives/18.html 阿里云源:https://mirrors.aliyun.com/pypi/simple 腾讯云源:https://mirrors.cloud.tencent.com/pypi/simple 豆瓣源:https://pypi.doubanio.com/simple 清华源:https://pypi.tuna.tsinghua.edu.cn/simple 华为源:https://repo.huaweicloud.com/simple 2.生成requirements.txt文件: 3.安装requirements.txt依赖: python -m pip install --upgrade pip pip freeze > requirements.txt pip install -r requirements.txt pip 指定包的目录 方法一 指定安装numpy包到固定文件夹下,比如这里“文件夹”是安装路径 pip install -t 文件夹 numpy pip3 install tensorflow==2.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple #自定义依赖安装包的路径 USER_SITE = null #自定义的启用Python脚本的路径 USER_BASE = null 我这里修改为 USER_SITE = "D:\program\Anaconda\envs\py36\Lib\site-packages" USER_BASE = "D:\program\Anaconda\envs\py36\Scripts" 验证 python -m site yum install python3-dev python3-pip python3-venv yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel conda 安装 # 获得最新的miniconda安装包; wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh # 安装到自己的HOME目录software/miniconda3中,这个目录在安装前不能存在; sh Miniconda3-latest-Linux-x86_64.sh -b -p ${HOME}/software/miniconda3 # 安装成功后删除安装包 rm -f Miniconda3-latest-Linux-x86_64.sh # 将环境变量写入~/.bashrc文件中; echo "export PATH=${HOME}/software/miniconda3/bin:\$PATH" >> ~/.bashrc # 退出重新登录或者执行以下命令 source ~/.bashrc #加速 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes #GPU 版 conda create -n tf-gpu-2.3.0 tensorflow-gpu==2.3.0 -y #CPU 版 conda create -n tf-2.3.0 tensorflow==2.3.0 -y source activate tf-2.3.0 python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))" import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' ##保证sess.run()能够正常运行 2.0版本的 import tensorflow as tf tf.__version__ tf.compat.v1.disable_eager_execution() hello = tf.constant('hello,tensorflow') sess= tf.compat.v1.Session() print(sess.run(hello)) #导入包 from hyperlpr import * #导入OpenCV库 import cv2 #读入图片 image = cv2.imread("D:\\tensorflow\\lpr-master\\test-imgs\\1.jpg") cv2.imshow("Image", image) #识别结果 print(HyperLPR_plate_recognition(image)) source deactivate win pip install tensorflow-1.6.0-cp36-cp36m-win_amd64.whl pip install tensorflow-2.3.0-cp38-cp38m-win_amd64.whl
常用的依赖项
pip install -r requirements.txt
absl-py==0.13.0 aniso8601==7.0.0 aplus==0.11.0 argon2-cffi==20.1.0 astropy==4.2.1 astunparse==1.6.3 async-generator==1.10 attrs==21.2.0 Automat==20.2.0 autopep8==1.5.7 backcall==0.2.0 beautifulsoup4==4.9.3 blake3==0.1.8 bleach==3.3.0 bqplot==0.12.29 bs4==0.0.1 cachetools==4.2.2 certifi==2021.5.30 cffi==1.14.5 chardet==4.0.0 click==8.0.1 cloudpickle==1.6.0 colorama==0.4.4 comtypes==1.1.10 constantly==15.1.0 cryptography==3.4.7 cssselect==1.1.0 cycler==0.10.0 d3dshot==0.1.5 dask==2021.6.1 decorator==5.0.9 defusedxml==0.7.1 entrypoints==0.3 et-xmlfile==1.1.0 flake8==3.9.2 Flask==2.0.1 frozendict==2.0.2 fsspec==2021.6.0 future==0.18.2 gast==0.3.3 google-auth==1.31.0 google-auth-oauthlib==0.4.4 google-pasta==0.2.0 graphene==2.1.8 graphene-tornado==2.6.1 graphql-core==2.3.2 graphql-relay==2.0.1 greenlet==1.1.0 grpcio==1.38.0 h2==3.2.0 h5py==2.10.0 hpack==3.0.0 hyperframe==5.2.0 hyperlink==21.0.0 idna==2.10 incremental==21.3.0 ipydatawidgets==4.2.0 ipykernel==5.5.5 ipyleaflet==0.14.0 ipympl==0.7.0 ipython==7.24.1 ipython-genutils==0.2.0 ipyvolume==0.5.2 ipyvue==1.5.0 ipyvuetify==1.7.0 ipywebrtc==0.6.0 ipywidgets==7.6.3 itemadapter==0.2.0 itemloaders==1.0.4 itsdangerous==2.0.1 jedi==0.18.0 Jinja2==3.0.1 jmespath==0.10.0 joblib==1.0.1 jsonschema==3.2.0 jupyter-client==6.1.12 jupyter-core==4.7.1 jupyterlab-pygments==0.1.2 jupyterlab-widgets==1.0.0 Keras==2.3.0 Keras-Applications==1.0.8 Keras-Preprocessing==1.1.2 kiwisolver==1.3.1 llvmlite==0.36.0 locket==0.2.1 lxml==4.6.3 Markdown==3.3.4 MarkupSafe==2.0.1 matplotlib==3.4.2 matplotlib-inline==0.1.2 mccabe==0.6.1 mistune==0.8.4 nbclient==0.5.3 nbconvert==6.0.7 nbformat==5.1.3 nest-asyncio==1.5.1 notebook==6.4.0 numba==0.53.1 numexpr==2.7.3 numpy==1.18.5 oauthlib==3.1.1 opencv-python==4.5.3.56 openpyxl==3.0.7 opt-einsum==3.3.0 packaging==20.9 pandas==1.2.4 pandocfilters==1.4.3 parsel==1.6.0 parso==0.8.2 partd==1.2.0 pickleshare==0.7.5 Pillow==7.1.2 priority==1.3.0 progressbar2==3.53.1 prometheus-client==0.11.0 promise==2.3 prompt-toolkit==3.0.19 Protego==0.1.16 protobuf==3.17.3 psutil==5.8.0 pyarrow==4.0.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycodestyle==2.7.0 pycparser==2.20 PyDispatcher==2.0.5 pyerfa==2.0.0 pyflakes==2.3.1 Pygments==2.9.0 PyMySQL==1.0.2 PyOpenGL==3.1.5 pyOpenSSL==20.0.1 pyparsing==2.4.7 pyrsistent==0.17.3 python-dateutil==2.8.1 python-utils==2.5.6 pythreejs==2.3.0 pytz==2021.1 pywin32==301 pywinpty==1.1.2 PyYAML==5.4.1 pyzmq==22.1.0 queuelib==1.6.1 requests==2.25.1 requests-oauthlib==1.3.0 rsa==4.7.2 Rx==1.6.1 scikit-learn==0.24.2 scipy==1.4.1 Scrapy==2.5.0 seaborn==0.11.1 Send2Trash==1.5.0 service-identity==21.1.0 simplejson==3.17.3 six==1.16.0 soupsieve==2.2.1 SQLAlchemy==1.4.20 tables==3.6.1 tabulate==0.8.9 tensorboard==2.5.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.0 tensorflow-cpu==2.3.0 tensorflow-estimator==2.3.0 termcolor==1.1.0 terminado==0.10.1 testpath==0.5.0 threadpoolctl==2.1.0 toml==0.10.2 toolz==0.11.1 torch==1.9.0 torchvision==0.10.0 tornado==6.1 traitlets==5.0.5 traittypes==0.2.1 tushare==1.2.64 Twisted==21.7.0 twisted-iocpsupport==1.0.1 typing-extensions==3.10.0.0 urllib3==1.26.5 vaex==4.3.0 vaex-astro==0.8.2 vaex-core==4.3.0.post1 vaex-hdf5==0.8.0 vaex-jupyter==0.6.0 vaex-ml==0.12.0 vaex-server==0.5.0 vaex-viz==0.5.0 vboxapi==1.0 w3lib==1.22.0 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.2.1 Werkzeug==2.0.1 widgetsnbextension==3.5.1 wrapt==1.12.1 xarray==0.18.2 xlrd==2.0.1 yapf==0.31.0 zope.interface==5.4.0