hyper-v中搭建本地服务器linux(CentOS 7)的python环境
游园活动作文,我心中最美老师作文,黄沙领主大转盘在哪
新建虚拟机->安装centos7->新建虚拟交换机:内部网络->centos7设置->网络适配器:虚拟交换机:新建虚拟交换机->进入centos
# cd /etc/sysconfig/network-scripts/
# ls
# vi ifcfg-eth0
添加或修改
onboot=yes
保存退出(按esc再:wq回车)
windows中本地网络连接将以太网与vethernet桥接
# service network restart
进路由器设置给linux分配静态ip
git安装
# yum install git -y
安装python编译依赖
# yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel
# adduser <name>
--------切用户--------
安装pyenv
$ curl -l https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
(若curl出错(35)ssl connect error ,需要配置一个有校新包的yum源
# vim /etc/yum.repos.d/dvd.repo
添加下文本
[updates]
name=centos-updates
baseurl=https://mirrors.aliyun.com/centos/6.9/os/x86_64
gpgcheck=0
# yum repolist
然后更新nss # yum update nss
~/.bash_profile中追加pyenv
export path="/home/python/.pyenv/bin:$path"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
$ vim ~/.bash_profile
使用pyenv的install安装所需版本的python
$ pyenv install help
$ pyenv install -l
$ pyenv install 3.7.1
本地安装
$ cd .pyenv
$ mkdir cache
$ cd cache/
use xftp copy python-3.7.1.tar.zx&python-3.7.1.tgz to /home/python/.pyenv/cache/
$ pyenv install 3.7.1
若 modulenotfounderror: no module named '_ctypes',其实是缺少了一个新需要的开发包libffi-devel,安装后即可再返回用户安装python
# yum install libffi-devel -y (包在base)
切换python本版
[global 全局设置、shell 用户设置、local 目录设置]
$ python local 3.7.1
virtualenv 虚拟环境
$ pyenv virtualenv 3.7.1 <vname>
$ pyenv local <vname>
创建 .pip 文件夹
$ mkdir .pip
$ cd .pip
$ touch pip.conf
$ vim pip.conf
[global]
index-url=https://mirrors.aliyun.com/pypi/simple/
trusted-host=mirrors.aliyun.com
$ cd
$ cd <vname>
安装ipython&jupyter和jupyter配置
$ pip install ipython
$ pip install jupyter
首先输入ipython生成秘钥
$ ipython
>>>from notebook.auth import passwd
>>>passwd()
使用jupyter前先设置密码
$ jupyter notebook password
$ jupyert notebook --ip=0.0.0.0
在windows浏览器中输入地址 192.168.xxx.xxx:8888
如果windows的浏览器连接不上jupyter,有可能是linux 防火墙阻止了,关闭掉
# systemctl stop firewalld
port&firewall more: https://www.cnblogs.com/moxiaoan/p/5683743.html
其它可能用到的指令:
查看linux本地端口 打包packages及加载
$ ss -tanl $ pip freeze > <name>
$ pip install -r <file_packages>
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
相关文章:
-
-
python如何查看网页代码
用python查看网页代码的方法:1、使用“import”导入requests包import requests2、使用requests包的get()函数通过网页...
[阅读全文]
-
-
python如何保存文本文件
python保存文本文件的方法:使用python内置的open()类可以打开文本文件,向文件里面写入数据可以用write()函数,写完之后,使用close()函...
[阅读全文]
-
python如何编写win程序
python可以编写win程序。win程序的格式是exe,下面我们就来看一下使用python编写exe程序的方法。编写好python程序后py2exe模块即可将...
[阅读全文]
-
-
-
-
-
-
网友评论