python绿色版的环境搭建(win)

2021-01-01  本文已影响0人  harv9y
一、将python目录环境添加到path
二、手动安装pip
下载地址:https://pypi.org/project/pip/

(点击installation,将get-pip.py另存为)

安装pip:
python get-pip.py

将python 目录下的script添加到path
在python根目录找到python38._pth文件,使用记事本打开,去掉 “import site”前面的 # 号

三、pip换源
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com

上述文本保存到%APPDATA%pip.ini

四、手动安装pyrsistent(直接装会报错)

下载地址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyrsistent
安装pyrsistent:

pip install pyrsistent-0.17.3-cp39-cp39-win_amd64.whl
五、批量安装包
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.3.0
backcall==0.2.0
bleach==3.2.1
cffi==1.14.4
colorama==0.4.4
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
ipykernel==5.4.2
ipython==7.19.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
jedi==0.18.0
Jinja2==2.11.2
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.7
jupyter-console==6.2.0
jupyter-contrib-core==0.3.3
jupyter-contrib-nbextensions==0.5.1
jupyter-core==4.7.0
jupyter-highlight-selected-word==0.2.0
jupyter-latex-envs==1.4.6
jupyter-nbextensions-configurator==0.4.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
lxml==4.6.2
MarkupSafe==1.1.1
mistune==0.8.4
nbclient==0.5.1
nbconvert==5.6.1
nbformat==5.0.8
nest-asyncio==1.4.3
notebook==6.1.6
packaging==20.8
pandocfilters==1.4.3
parso==0.8.1
pickleshare==0.7.5
prometheus-client==0.9.0
prompt-toolkit==3.0.8
pycparser==2.20
Pygments==2.7.3
pyparsing==2.4.7
python-dateutil==2.8.1
pywin32==300
pywinpty==0.5.7
PyYAML==5.3.1
pyzmq==20.0.0
qtconsole==5.0.1
QtPy==1.9.0
Send2Trash==1.5.0
six==1.15.0
terminado==0.9.1
testpath==0.4.4
tornado==6.1
traitlets==5.0.5
wcwidth==0.2.5
webencodings==0.5.1
widgetsnbextension==3.5.1

以文本方式保存到桌面“1.txt”,下用面的命令批量安装

pip install -r 1.txt

六、其它配置:

1.生成jupyter配置文件
jupyter notebook  --generate-config
2.修改jupyter默认打开的目录

打开刚生成的配置文件,找到c.NotebookApp.notebook_dir 取消注释并改成工作目录(注意斜线方向!)

c.NotebookApp.notebook_dir = 'D:/workSpace/python'
3.jupyter 自动补全
jupyter contrib nbextension install --user --skip-running-check
4.如果需要在谷歌的colab中打开
c.NotebookApp.allow_origin = 'https://colab.research.google.com'

打开配置文件查找c.NotebookApp.allow_origin,取消注释并修改

参考:
https://blog.csdn.net/vooandvivi/article/details/108473758
https://blog.csdn.net/outsider2019/article/details/109274996
https://zhuanlan.zhihu.com/p/46975553
https://zhuanlan.zhihu.com/p/54302333
https://www.pythonf.cn/read/132119
https://www.jianshu.com/p/0ab80f63af8a

上一篇下一篇

猜你喜欢

热点阅读