这个大部分人都知道 ,大部分都是通过PIP 包管理工具
至于PIP 这个工具 大部分的python3 环境都默认安装,如果没有安装也没有关系,可以通过其他办法安装
举个例子,亲测,可以使用:
PIP 安装教程
PIP的使用,网上有一大堆,这里不做赘述。
举个例子:
PIP 的使用
使用 ‘python -m site’
命令
C:Users******>python -m site
sys.path = ['C:\Users\*****','D:\Code\Python\Python36\python36.zip','D:\Code\Python\Python36\DLLs','D:\Code\Python\Python36\lib','D:\Code\Python\Python36','D:\Code\Python\Python36\lib\site-packages',
]
USER_BASE: 'C:\Users\******\AppData\Roaming\Python' (doesn't exist)
USER_SITE: 'C:\Users\******\AppData\Roaming\Python\Python36\site-packages' (doesn't exist)
ENABLE_USER_SITE: True
其中这里有几点说明:
①我们看见这里的USER_BASE 和USER_SITE其实就是用户自定义的启用Python脚本和依赖安装包的基础路径。
②其中USER_BASE表示就是在C盘这个目录下的启动程序路径以及pip,esay-install,markdown等脚本,(我们已经是安装好了Anaconda Python,这个C盘又是什么鬼,不想用它啊),而这个C盘的启动程序路径其实就是我们在安装Anaconda的时候一个分身,更准确的说,其实就是简单的Python程序,并不是什么IDE这种级别的可以类似Eclipse这样去操作编译丰富的功能窗口,只是简单类似shell的一样的存在。
所以要改。
③其中的USER_SITE其实就是用户如果调用C盘路径下的中的脚本pip文件去下载,就会将site-package的默认安装到这个C盘路径下。
使用cmd命令:python -m site -help
就会出现
C:Users*****>python -m site -help
D:CodePythonPython36libsite.py [--user-base] [--user-site]Without arguments print some useful information
With arguments print the value of USER_BASE and/or USER_SITE separated
by ';'.Exit codes with --user-base or --user-site:0 - user site directory is enabled1 - user site directory is disabled by user2 - uses site directory is disabled by super useror for security reasons>2 - unknown e
打开查询得到的.py文件找到如下内容
import sys
import os
import builtins
import _sitebuiltins# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, _prefix]
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None# for distutilsmands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
USER_SITE = None
USER_BASE = None
修改其中84、85行内容,即“USER_SITE = None”,“USER_BASE = None”
的内容。
注意
USER_SITE = “F:Anacondalibsite-packages”
这个是你要安装下载的site-packages的路径。
而执行下载的pip等脚本路径是由USER_BASE决定,并且一定一定要换到同样的有pip脚本的路径下,哪怕你路径也请写到
F:Anaconda
当然这里最好写成
USER_BASE = “F:AnacondaScripts”
在C盘用户文件夹的根目录下新建名为pip的文件夹
在pip文件夹下新建pip.ini文件,并在其中添加如下代码:
[global]
timeout = 6000
index-url =
trusted-host = pypi.tuna.tsinghua.edu
其中镜像源可以替换,常见的国内镜像源有:
V2EX:
豆瓣:
中国科学技术大学:
清华:
其实,方法很简单,一种就是只使用blender 的那个python 环境,这样的话,就可以安装使用的都是一个site-pakage
目录,但是我相信很多人是先学习python ,再开始玩blender scripts.所以嘛。
上面的这种方式,我亲测过,是可以,但是很不灵活,因为 存在 多个python 环境下 ,他一直会以计算机环境变量的那个为准,就算 修改site.py 也没有多大的意义,因为不是对应的 < 启动的话,修改是不会生效的,所以,个人感觉最简单最粗暴的方式反而最直接 。
site-pakge
里面的包(要改的那个包),拷贝到blendr内部的site-pakge
里面*另一种,也是我最推荐的,python 启动的时候用blender 内部的 (简单而优雅)
本文发布于:2024-02-04 14:37:53,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170709523456436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |