npm 修改源 pip 修改源


npm修改源
由於不可說原因,npm install時,速度總是不盡如人意,解決辦法是修改npm的數據源
npm config set registry https://registry.npm.taobao.org
1
修改后可以通過這個進行測試

npm config get registry

 

 

pip-修改為國內鏡像源

 

pip 常用命令

pip install ./downloads/SomePackage-1.0.4.tar.gz 
pip install http://my.package.repo/SomePackage-1.0.4.zip
pip search "query"   ##查詢package的具體名稱
pip uninstall package-name  ##卸載
pip install SomePackage==1.0.4  ##指定版本的安裝
pip install --upgrade SomePackage  ##package 版本升級

pip-修改國內鏡像源

mkdir ~/.pip 
vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com

注意事項:

  1. http://mirrors.aliyun.com/pypi/simple/中的simple目錄必須有。
  2. --no-cache-dir重新下載安裝包,而不是使用緩存包。
  3. trusted-host = mirrors.aliyun.com一定要加上這行,否則會報錯。
  4. pip國內鏡像源。

    阿里雲 http://mirrors.aliyun.com/pypi/simple/
    中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/
    豆瓣 http://pypi.douban.com/simple
    Python官方 https://pypi.python.org/simple/
    v2ex http://pypi.v2ex.com/simple/
    中國科學院 http://pypi.mirrors.opencas.cn/simple/
    清華大學 https://pypi.tuna.tsinghua.edu.cn/simple/

報錯匯總

報錯內容

pip install mysql-python
Collecting mysql-python
  The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pypi.douban.com'.
  Could not find a version that satisfies the requirement mysql-python (from versions: )
No matching distribution found for mysql-python

解決辦法

編輯 vim .pip/pip.conf

[install]
trusted-host = mirrors.aliyun.com


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM