Win10环境问题记录

  • 换源问题
    • NPM换源
    • PIP换源
  • 个别问题

人无远虑必有近忧,决定自学python给自己加点技能,这里把学习过程做个记录。

换源问题

NPM换源

局域网手动换源很麻烦,推荐安装nrm对镜像源进行管理。

npm install -g nrm

nrm ls   //查看镜像源, *表示正在使用的

	* npm -------- https://registry.npmjs/       
	  yarn ------- https://registry.yarnpkg/     
	  cnpm ------- http://rpmjs/
	  taobao ----- https://registry.npm.taobao/  
	  nj --------- https://registry.nodejitsu/   
	  npmMirror -- https://skimdb.npmjs/registry/
	  edunpm ----- http://registry.enpmjs/       

nrm use taobao //切换

PIP换源

python避免不了引用三方库,默认官方仓库的速度很慢。

  • 方案一:运行命令配置
pip config set global.index-url https://mirrors.aliyun/pypi/simple/
  • 方案二:创建pip.conf文件
    • 在C:\Users\User 目录找到下列文件 /pip/pip.conf ,如果没有的话可以手动创建
    • 在上述文件中添加或修改:
[global]
index-url = https://mirrors.aliyun/pypi/simple/

[install]
trusted-host=mirrors.aliyun

个别问题

执行npm install 的时候报错:npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
解决方案:使用管理员权限执行命令

npm install --global --production windows-build-tools

如果遇到windows-build-tools 安装时一直卡住的情况,优先考虑网络问题。推荐换个npm源试试。

更多推荐

【python自学笔记】Win10环境问题记录