1. 程式人生 > 其它 >pip 安裝依賴 設定加速目錄 Conda 設定加速安裝

pip 安裝依賴 設定加速目錄 Conda 設定加速安裝

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