
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-develyum -y install wget # 没安装wget工具时运行此命令
wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgztar -xzvf Python-3.7.5.tgzyum install gcc -y # 安装gcc编译器
yum install libffi-devel -y # 3.7版本之后需要一个新的包libffi-devel
cd Python-3.7.5 # 进入解压后的文件夹
./configure --prefix=/home/python # 配置指定安装目录
make && make install # 编译&编译安装export PYTHON_HOME=/home/pythonexport PATH=${PATH}:${PYTHON_HOME}/bin
vi /etc/profile # 在/etc/profile文件中加入上面两行内容
source /etc/profile # 添加完需要重新加载配置#!/bin/sh
yum -y install wget # 安装wget工具
yum -y install gcc # 安装gcc
# 安装一堆依赖
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
yum -y install libffi-devel
if [ ! -f "Python-3.7.5.tgz" ] # 判断当前目录是否存在Python安装包
then
echo Python-3.7.5.tgz not exist!!!
exit -1
fi
`tar -zxvf Python-3.7.5.tgz` # 解压安装包
if [ ! -d /home/python3 ] # 判断home目录下是否存在python3目录,不存在就创建
then
`mkdir -p /home/python3`
cd Python-3.7.5
./configure --prefix=/home/python3 # 配置安装目录为/home/python3
make && make install # 编译&编译安装
fi
# 添加Python环境变量到/etc/profile
echo "export PYTHON_HOME=/home/python3" >>/etc/profile
echo "export PATH=\${PATH}:\${PYTHON_HOME}\"/bin\"" >>/etc/profile
# 重新加载配置文件,注意:执行脚本时需使用source命令而非./或sh命令,否则环境变量不生效
`source /etc/profile`
# 设置Python安装镜像源为阿里云
`pip config set global.index-url https://mirrors.aliyun.com/pypi/simple`
echo "=====`date`===== Python-3.7.5 install success !!!====="source python_install.sh
验证一下python3是否安装成功,以及脚本最后更改的pip镜像源是否生效:
从上图可以看出,python3安装成功,python镜像源已成功替换为阿里云镜像源。rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps # 卸载python3
whereis python3 |xargs rm -frv # 删除python3所有残余文件,注意是卸载Python3,千万要带3,否则会把系统自带的Python2和yum(依赖Python2)也卸载了
whereis python3 # 查看是否存在python3
python3 # 进入python解释器环境,若提示“-bash: python3: command not found”则说明卸载成功python3 -m venv auto_test # 新建名为auto_test的虚拟环境目录
cd auto_test/bin # 进入虚拟环境所在文件夹的bin目录(Windows进入Scripts目录)
source activate # 激活虚拟环境(Linux&Mac系统用source命令,Windows用.\activate.bat命令激活
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple(镜像地址) module(模块名称)国内镜像源:清华:https://pypi.tuna.tsinghua.edu.cn/simple阿里云:http://mirrors.aliyun.com/pypi/simple/中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/华中理工大学:http://pypi.hustunique.com/山东理工大学:http://pypi.sdutlinux.org/豆瓣:http://pypi.douban.com/simple/
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple # 永久配置国内镜像源
pip config list # 查看下载源配置列表

pip freeze > requirements.txt # 导出当前环境下已安装的依赖包列表到指定文件
pip download -r requirements.txt -d . # 下载指定文件中的所有依赖包,不安装
pip install -r requirements.txt # 批量安装
如何正确创建Rails迁移,以便将表更改为MySQL中的MyISAM?目前是InnoDB。运行原始执行语句会更改表,但它不会更新db/schema.rb,因此当在测试环境中重新创建表时,它会返回到InnoDB并且我的全文搜索失败。我如何着手更改/添加迁移,以便将现有表修改为MyISAM并更新schema.rb,以便我的数据库和相应的测试数据库得到相应更新? 最佳答案 我没有找到执行此操作的好方法。您可以像有人建议的那样更改您的schema.rb,然后运行:rakedb:schema:load,但是,这将覆盖您的数据。我的做法是(假设
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121