标签:aliyun 默认 global under echo content error 版本管理 url
? ~ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
? ~ echo $PATH
/Users/abc/.nvm/versions/node/v8.13.0/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin
? ~ sudo vim /etc/bashrc
export PATH=/Library/Frameworks/Python.framework/Versions/3.7/bin:$PATH
pip下载安装Python库很慢,可使用国内镜像网站加速,操作方法有二。
pip install -i https://pypi.douban.com/simple/ sqlalchemy
pip添加配置文件
mkdir .pip
touch .pip/pip.conf
[global]
index-url=http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
[global]
index-url=http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
[global]
index-url=http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host=mirrors.aliyun.com
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
[global]
index-url=https://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.mirrors.ustc.edu.cn
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
$ env1/bin/pip freeze > requirements.txt
$ env2/bin/pip install -r requirements.txt
? / cd /tmp
? /tmp python3 -m venv venv1
? /tmp python3 -m venv venv2
? /tmp source venv1/bin/activate
(venv1) ? /tmp pip3 install requests
? ~ cd /tmp
? /tmp source venv2/bin/activate
引入requests
(venv2) ? /tmp python3
>>> import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named ‘requests‘
标签:aliyun 默认 global under echo content error 版本管理 url
原文地址:https://www.cnblogs.com/cloudwas/p/13207898.html