002.python环境搭建ipython、pycharm以及包的导出

一. 安装ipython

本应该用pip install ipython直接安装的,但是可能需要一些认证以及安装速度较慢,所以这里引入阿里的pip源:

cd ~

mkdir .pip

cd .pip/

vim pip.conf写入以下内容:

[global]

index-url=https://mirrors.aliyun.com/pypi/simple/

trusted-host=mirrors.aliyun.com

保存退出,再执行pip install ipython即可成功安装ipython

顺便升级下pip:

cd xhs/project/test/

python -m pip install --upgrade pip

pip -V

二. 安装jupyter

pip install jupyter

jupyter notebook --help 看下用法

jupyter notebook password 设个密码

jupyter notebook 启动jupyter

jupyter notebook --ip=0.0.0.0 --port=8888 制动某些ip和端口可以访问,这里允许所有ip通过8888端口来访问jupyter,我在本机试下:

我虚拟机的ip是192.168.0.127

三. 导出包

将当前虚拟环境已安装的包的名称以及版本保存到一个临时文件中:

pip freeze>requirement.txt

将已安装的包及其版本暂存到一个临时文件

若我现在想到另一个服务器上部署相关的软件包该这么做呢?

pip help install 看下有这么一条:

-r, --requirement Install from the given requirements file. This option can be used multiple times.

所以我们在目标服务器上可以这样干:

pip install -r requirement.txt

这样项目上线就方便多了,生产环境和测试环境的包就一样了

四. pycharm的安装及使用

(略)

你可能感兴趣的:(002.python环境搭建ipython、pycharm以及包的导出)