@@ -32,9 +32,9 @@ categories:
3232 - 3.1.1. [ http] ( #http )
3333 - 3.1.2. [ virtualenv] ( #virtualenv )
3434 - 3.1.3. [ pip] ( #pip )
35- - 3.1.3.1. [ Requirements files ] ( #requirements-files )
36- - 3.1.3.2. [ 发布包到 pypi ] ( #发布包到-pypi )
37- - 3.1.4. [ matplotlib ] ( #matplotlib )
35+ - 3.1.3.1. [ 依赖管理 ] ( #依赖管理 )
36+ - 3.1.3.2. [ Requirements files ] ( #requirements-files )
37+ - 3.1.3.3. [ 发布到pypi ] ( #发布到pypi )
3838 - 3.2. [ 文件操作] ( #文件操作 )
3939 - 3.2.1. [ JSON] ( #json )
4040 - 3.2.2. [ conf或者ini] ( #conf或者ini )
@@ -52,7 +52,7 @@ categories:
5252 - 3.7.2. [ 时间处理] ( #时间处理 )
5353 - 3.7.3. [ 三方库] ( #三方库 )
5454
55- 💠 2024-12-19 21:03:00
55+ 💠 2024-12-26 11:42:45
5656****************************************
5757# Python
5858> [ Official Site] ( https://www.python.org/ )
@@ -534,23 +534,18 @@ When importing the package, Python searches through the directories on `sys.path
534534python -m module_name
535535
536536### http
537- - 快速启动一个 HTTP Web 服务器 ` http .server [port]`
537+ - 快速启动一个 HTTP Web 服务器 ` python -mhttp .server [port]`
538538
539539### virtualenv
540- > [ 廖雪峰 virtualenv] ( https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/001432712108300322c61f256c74803b43bfd65c6f8d0d0000 )
541540
542- ** 虽然也可以用apt安装 python-venv, 但是最好不要这样,避免后续模块升级后不必要的冲突**
543-
544- - 创建环境 ` python3 -m venv web ` 或者 ` virtualenv --no-site-packages web ` 不将系统中安装的包带入该环境
541+ - 创建环境 ` python3 -m venv web `
545542- 启动环境 ` source web/bin/activate `
546- - 在环境中使用的pip python 都是环境中的 , 其实就是修改了系统的环境变量指向
543+ - 在环境中使用的pip python命令都是web目录下的 , 其实就是修改了系统的环境变量指向
547544- 停用环境 ` deactivate `
548545
549546### pip
550547> [ pip] ( https://pip.readthedocs.io/en/stable/ ) | [ doc] ( https://pip.pypa.io/en/stable/reference/pip_install/ ) | [ guide] ( https://packaging.python.org/tutorials/installing-packages/ )
551548
552- > [ uv] ( https://docs.astral.sh/uv/ ) Rust实现的包管理
553-
5545491 . 作为Python的包管理器, 包的可执行文件默认在 /usr/local/bin 目录下(全局)
555550 - 如果安装时加了该参数 --user 就是安装在 ~ /.local/bin 目录下
556551
@@ -568,11 +563,14 @@ python -m module_name
568563- 可以设置默认全局 python3 -m pip config set global.break-system-packages true
569564- 或者单次安装到全局 --break-system-packages
570565
571- > 3.10 后 pip 作为子模块
566+ > 3.10 后 pip 作为子模块使用
572567- 安装 ` python -m ensurepip --upgrade `
573568- 使用 ` python -m pip install pkgName `
574569- 升级 ` python -m pip install --upgrade pip `
575570
571+ #### 依赖管理
572+ 当发现环境内一个包有多个版本时,可以通过直接打开python解释器,import包,执行 包名._ version 查看, 例如 ` pandas._version ` 或 ` pandas.__version__ `
573+
576574#### Requirements files
577575> [ pip官方文档 Requirements files] ( https://pip.readthedocs.io/en/1.1/requirements.html )
578576
@@ -582,7 +580,7 @@ python -m module_name
582580
5835811 . 使用 ` pip install -r requirements.txt `
584582
585- #### 发布包到 pypi
583+ #### 发布到pypi
586584> [ Official : about package] ( https://packaging.python.org/guides/distributing-packages-using-setuptools/?highlight=pypirc#id78 )
587585
5885861 . edit ` $HOME/.pypirc ` to save authorization info
@@ -602,11 +600,8 @@ python -m module_name
602600> 1. pip install collective.checkdocs Pygments
603601> 1. python3 setup.py checkdocs
604602
605- ### matplotlib
606-
607603************************
608604
609-
610605## 文件操作
611606
612607- 注意路径,Windows系统中要使用反斜杠 \
0 commit comments