vpython

如何修改 CentOS 6.x 上默认Python

前提是你 提交于 2021-01-13 15:26:19
最近在工作中遇到一个问题,就是有一个功能希望在各种服务器上实现,而服务器上的系统版本可能都不一样,有的是 CentOS 6.x,有的是 CentOS 7.x 。 需要说明的一点是,CentOS 6.x 上的 Python 版本是 2.6.x 的,而 CentOS 7.x 上的 Python 版本是 2.7.x 的,这意味着我要实现的功能要适配这两种版本的系统。 你可能会说,这有什么的,自己写的时候,注意一下就好了。 事情其实没有那么容易,我要实现的功能是基于一个框架进行定制,需要修改不少的框架代码。这个框架在不同的 Linux 版本上,是有不同的版本的,而且差异巨大,曾经想过在 CentOS 6.x 和 CentOS 7.x 将这个框架安装成同一个版本,最后还是失败了,无法安装,原因就是高版本需要 Python2.7,而 CentOS 6.x 上只有 Python2.6。 这个历史问题一直遗留到现在,由于这次的功能影响到的代码较多,如果要对两个版本的框架分别进行定制的话,需要花不少的时间,为了不维护两套版本,避免浪费多余的精力去做适配,我决定将 CentOS 6.x 上默认的 Python2.6 升级成 Python2.7。 下面是整个升级过程,别看步骤简单,这些精简步骤的背后可是有不少的坑,被我踩过后,你可以直接使用了。 首先确认下你机器上的默认的 Python 版本 $

如何升级 CentOS 6.x 上默认Python

╄→尐↘猪︶ㄣ 提交于 2021-01-13 14:49:41
最近在工作中遇到一个问题,就是有一个功能希望在各种服务器上实现,而服务器上的系统版本可能都不一样,有的是 CentOS 6.x,有的是 CentOS 7.x 。 需要说明的一点是,CentOS 6.x 上的 Python 版本是 2.6.x 的,而 CentOS 7.x 上的 Python 版本是 2.7.x 的,这意味着我要实现的功能要适配这两种版本的系统。 你可能会说,这有什么的,自己写的时候,注意一下就好了。 >本期小编推送2021初学者一定会用到的Python资料,含有小编自己呕心沥血整理的免费书籍/视频/在线文档和编辑器/源代码,关于`Python`的安装qun:850973621 事情其实没有那么容易,我要实现的功能是基于一个框架进行定制,需要修改不少的框架代码。这个框架在不同的 Linux 版本上,是有不同的版本的,而且差异巨大,曾经想过在 CentOS 6.x 和 CentOS 7.x 将这个框架安装成同一个版本,最后还是失败了,无法安装,原因就是高版本需要 Python2.7,而 CentOS 6.x 上只有 Python2.6。 这个历史问题一直遗留到现在,由于这次的功能影响到的代码较多,如果要对两个版本的框架分别进行定制的话,需要花不少的时间,为了不维护两套版本,避免浪费多余的精力去做适配,我决定将 CentOS 6.x 上默认的 Python2.6 升级成

Error running Vpython in Spyder (NameError: name 'gsprint' is not defined)

让人想犯罪 __ 提交于 2020-04-30 14:31:23
问题 NameError: name 'gsprint' is not defined I repeatedly get this error message when trying to run this: from vpython import * box() I am using Python 3.7.3 and Spyder 3.3.4, and cannot find any help in documentation. Vpython website says I should be able to run it: https://vpython.org/presentation2018/install.html 回答1: I had the same issue: I kept getting these "NameError: name 'gsprint' is not defined" error messages when running codes with the from vpython import * line. Strangely, the same

Error running Vpython in Spyder (NameError: name 'gsprint' is not defined)

偶尔善良 提交于 2020-04-30 14:30:21
问题 NameError: name 'gsprint' is not defined I repeatedly get this error message when trying to run this: from vpython import * box() I am using Python 3.7.3 and Spyder 3.3.4, and cannot find any help in documentation. Vpython website says I should be able to run it: https://vpython.org/presentation2018/install.html 回答1: I had the same issue: I kept getting these "NameError: name 'gsprint' is not defined" error messages when running codes with the from vpython import * line. Strangely, the same

This doesn't produce a window and I don't know why

馋奶兔 提交于 2020-01-05 04:21:07
问题 I am using VPython in my attempt to model a ball bouncing off a wall. To make my code more elegant, I have decided to use class inheritance to set the dimensions and properties of my objects (at the moment, it's the ball and a wall). After I ran the code, the shell didn't produce any errors, however, it did not produce a window either. I am fairly new to programming and I am using VPython 2.7 in Wine on Linux Mint 18. I have a feeling that I have missed something obvious but I don't know what

Simulating Orbits

感情迁移 提交于 2019-12-24 18:57:44
问题 So I'm trying to simulate the earth travelling around the sun where the velocity of the earth is determined by the angle its at to the origin and the horizontal. I did this by creating a function that uses tanh (opposite/adjacent) rule for triangles, O_correction(x,y) . The problem is that instead of a circular orbit its instead spiralling out and I'm not sure why. scene = canvas() scene.background = color.white O = 0 ball = sphere(pos=vector(10,0,0), radius=0.1, color=color.blue) x = ball

Run vpython in python3 without jupyter possible?

落爺英雄遲暮 提交于 2019-12-24 08:29:18
问题 In Python2.7 all my visual scripts were running fine. When I use Python3.5 I get the error message: get_ipython().kernel.comm_manager.register_target('glow', GlowWidget) AttributeError: 'NoneType' object has no attribute 'kernel' When I google the error message people say that you should use the jupyter notebook. But is it possible to run my old scripts without jupyter? 回答1: you should install ipython and Jupyter Notebook, as following sudo apt-get install ipython ipython-notebook pip install

GTK::Socket and Gtk::Plug unexpected behaviour under Gnome and FVWM2

不羁的心 提交于 2019-12-23 03:56:13
问题 The following code works fine if run within FVWM2. But if you change desktop to Gnome, then the embedded window is destroyed instead of being embedded. Why is that? What am I missing?... The code follows but basically all it does is fork. In the child, we create a VPython window an let it idle forever. In the parent, we create a GTK window, find out what the window ID of the child window is, and try to embed it vis a GTK::Socket. Note that the VPython part maybe irrelevant to this. #!/usr/bin

Snakemake: unknown output/input files after splitting by chromosome

穿精又带淫゛_ 提交于 2019-12-20 03:36:32
问题 To speed up a certain snakemake step I would like to: split my bamfile per chromosome using bamtools split -in sample.bam --reference this results in files named as sample.REF_{chromosome}.bam perform variant calling on each resulting in e.g. sample.REF_{chromosome}.vcf recombine the obtained vcf files using vcf-concat (VCFtools) using vcf-concat file1.vcf file2.vcf file3.vcf > sample.vcf The problem is that I don't know a priori which chromosomes may be in my bam file. So I cannot specify

Guitar string code in Python? [closed]

拈花ヽ惹草 提交于 2019-12-19 21:50:46
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I'm very new at Python but really interested in making a code that could simulate guitar strings. How would I go about doing this? Or at least how would I begin to do this? Any help is appreciated! Thank you! EDIT: I would like to see the sound waves when playing different strings