1. Python第三方包(pypi包和GitHub上包)安装相关
从包目录中运行包中的setup.py
文件(pycharm-Terminal)
python setup.py install
2. 安装line_profiler
方案1. 使用pip install line_profiler
和py -m pip install line_profiler
方案2. 离线安装Pycharm在线/手动离线安装第三方库-以scapy为例(本地离线添加已经安装的第三方库通过添加Path实现)
下载二进制文件https://www.lfd.uci.edu/~gohlke/pythonlibs/#line_profiler
以上均失败。
成功方案:
conda install -c anaconda line_profiler
3. 安装gym
参考https://www.pianshen.com/article/6285755030/
终端输入:
pip install gym -i https://pypi.tuna.tsinghua.edu.cn/simple
测试:
import gym
env = gym.make('CartPole-v0')
env.reset() #重置环境
for _ in range(1000): #1000帧
env.render() #每一帧重新渲染环境
env.step(env.action_space.sample()) # take a random action
测试结果:

网友评论