Pip安装代码快捷复制

16 篇文章 0 订阅
3 篇文章 0 订阅

Python配置环境、安装模块的常用指令

一些常用的指令代码


pip install --default-timeout=100 --ignore-installed --upgrade tensorflow-gpu==1.12.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip uninstall numpy -i https://pypi.douban.com/simple/
pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install h5py==2.8.0rc1 -i https://mirrors.aliyun.com/pypi/simple/
pip install tensorflow==1.14.0 -i https://pypi.mirrors.ustc.edu.cn/simple/
pip install --default-timeout=100 --ignore-installed --upgrade tensorflow==1.14.0 -i http://pypi.hustunique.com/
pip install --default-timeout=100 --ignore-installed --upgrade numpy==1.18.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pyqtwebengine==5.12 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install pyglet -i https://pypi.tuna.tsinghua.edu.cn/simple
pyqtwebengine
pip3 install --upgrade --force-reinstall --no-cache-dir jupyter 更新,强制重新安装,不使用已缓存包安装jupyter
pip install numpy --proxy="http://192.168.1.38:7890"	// 代理
all_proxy="http://192.168.0.129:7890" pip install scikit-image

github 安装包
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git'
安装指定版本,按照tag
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.2.1'

#------------------------------------------------------------------------
安装gym
pip install gym -i  https://pypi.tuna.tsinghua.edu.cn/simple
conda install swig
pip install box2d-py -i  https://pypi.tuna.tsinghua.edu.cn/simple
测试gym
import gym
import time
env = gym.make('CartPole-v0')
env.reset()
env.render()
time.sleep(10)
env.close()
#------------------------------------------------------------------------------

python
import tensorflow as tf
tf.__version__
exit()

pip show tensorflow # 显示包详情

pip uninstall tensorflow==2.0.0



conda create -n tensorflow_gpu python=3.6
conda create -n mytensorflow python=3.6
conda remove -n mytensorflow --all		#删除mytensorflow环境 慎用
activate tensorflow 
conda create -n new_environment --clone old_environment #复制环境
conda create -p /usr/local/anaconda3/envs/torch160 --clone pytorch_1_6_0	# 复制环境至指定目录 环境名称为torch160
查看环境
conda env list
conda uninstall pip # 卸载pip
查看所安装的包
pip list 



import tensorflow as tf
hello = tf.constant('Hello,TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

# 关于代理
unset http_proxy
unset https_proxy
curl cip.cc	#验证代理

env|grep -i proxy		#查看proxy
set | grep -i all_proxy		#查看all_proxy

# 命令行输入时只改变当前终端的
export http_proxy=http://127.0.0.1:8889/	
export https_proxy=http://127.0.0.1:8889/
export all_proxy=socks://127.0.0.1:1089/
export ALL_PROXY=socks://127.0.0.1:1089/
export socks_proxy=socks://127.0.0.1:1089/
永久改可在配置文件后加上上面几句, 改变当前用户的
~/.bashrc 个人用户bash初始化环境变量文件
/etc/bashrc 所有用户bash初始化环境变量文件

pip install pysocks

#============ pip
pip config set global.index-url https://pypi.douban.com/simple/  # 统一更改为豆瓣源(用户)
pip config set global.index-url https://pypi.python.org/simple/			#恢复默认
gedit ~/.config/pip/pip.conf	#设置的pip源写入在此 ~代表用户目录 

# =============== conda
gedit ~/.condarc
conda config --show-sources
conda config --show 显示详细信息

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --remove channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes


下载地址
https://download.pytorch.org/whl/cu100/torch_stable.html   #两个都可 根据cu100
https://download.pytorch.org/whl/cu101/torch_stable.html	#cu101
https://download.pytorch.org/whl/cu102/torch_stable.html	#cu102
下载
torch-1.5.0-cp36-cp36m-linux_x86_64.whl	# 36代表python3.6 
切换到你要安装的环境 离线安装
pip install torch-1.5.0-cp36-cp36m-linux_x86_64.whl	# 36代表python3.6 

一些常用的命令行

pscp -P 22 C:\Users\hongc\Desktop\iphoneimg\3.jpg citaa@192.168.1.136:/home/citaa

其他


conda只会安装一次,安装路径为 xxx\Anaconda3\pkgs
pip会根据不同的env下载多次,路径为xxx\Anaconda3\envs\conda_env\Lib\site-packages。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值