csatblogspotdotcom

Tuesday, January 8, 2019

网段隔离的一种实现

网段隔离的一种实现
一套物理网络虚拟出多套网络

    客户中心点与多个分支点组网,每个分支点与中心点/汇聚点之间都开有一条点对点以太网专线。客户每个办公点都有多个应用,例如视频会议的、OA的、财务的等,这多个数据流之间需要彼此隔离,例如OA网段就不能访问视频会议。
    原本计划在汇聚端用汇聚口和客户设备对接,即一个物理光口里面划分多个逻辑接口,逻辑接口之间用VLAN隔离,但客户测试反馈没法实现隔离。
    后来咨询了设备厂家,给出建议,将汇聚端的汇聚口全部改为独立的物理端口,这样分支点到中心点之间全部是透明管道,里面传输的数据不管带不带VLAN、带什么VLAN,都可以双向传送;客户在中心点加三层交换机并配置ACL,每个分支点加一台二层交换机,分支点的前两个端口固定是走指定业务例如视频会议,无法和其他网段/业务互通,后面的端口固定走其他业务例如OA,也无法和其他网段/业务互通。问题解决。

Labels: , ,

Sunday, January 6, 2019

word多页拼接打印到文件(长页的虚拟打印)

word多页拼接打印到文件(长页的虚拟打印)

word默认布局是A4纸大小,打印成pdf文件是一页word打一页pdf,如果多页拼接成一页怎么办?摸索了半天,发现在word的“页面设置”里面“纸张大小” ,增加高度即可。

word的一页,可以理解为一张虚拟的“纸”,纸有多大?一般是A4纸大小,也可以换成其他模板大小,如果要调整到自己需要的大小,就到“页面设置”里“纸张大小”调整宽度和高度,高度扩大之后就可以把多页拼接成一页“纸”。如果使用A4纸张把这张虚拟的“纸”打印出来,自然没法打印那么高的页面。

如果要保存成其他格式的文件,例如pdf,本质上是把word里这张“纸”转换为pdf格式的“纸”,即从一种虚拟“纸”转换为另一种虚拟“纸",转换能否成功,和转换的软件/驱动即虚拟打印机,有直接的关系。在win7上,word里Paperless Printer打印出来可以拼接一页多的A4高度,再后面就被截断了,而word里Foxit Reader PDF Printer可以支持到55.87厘米的高度(word里纸张自定义大小的最高高度);在win10上自带的Microsoft Print to PDF支持的高度不高(word里面),比A4高不了多少(后面被截断),但是word里Microsoft XPS Document Writer虚拟打印可以支持到55.87厘米高度,XPS查看器里Microsoft Print to PDF也支持到55.87里面高度,所以长页可以先word里打印成XPS(oxps)后缀,然后再XPS打印成PDF。

Labels: , ,

Tuesday, July 4, 2017

华为手机变砖的解决

机型:华为荣耀3C,H30-U10,2G+8G
更新到最新版 H30-U10_EMUI3.0_Android4.4_V100R001CHNC00B268 用了一段时间后,无法锁屏,反复出现 很抱歉键盘锁停止运行 ,只好一边不停点着一边设置成不锁屏,可是用了一段时间后通信录居然打不开,也是一开就提示停止运行,打电话、短信,都打不开用不了,于是只能尝试系统恢复,可是发现居然无法恢复,重启后还是老系统,最后发现是无法进入recovery模式,而且无法三键强刷(从SD卡强制升级),fastboot模式可以进,后面在刷机精灵帮助下进了一次recovery,再后面就怎么都进不了,手机也成砖头了,于是找到工具,参考:
http://www.shuame.com/faq/restore-tutorial/690-jzhf.html
http://www.shuame.com/faq/restore-tutorial/3283-h30-u10.html
在 win7 64 系统上操作,不行,最后找了一台 Windows XP 系统装好驱动,用线刷工具一刷就OK了,可以进 recovery ,再后面就是从SD卡升级到最新系统,最后恢复用户数据。

总结下,手机有 fastboot 和 recovery 两种模式,recovery 下可以进行卡刷,如果 recovery 损坏无法进入,只能线刷,即用USB连接PC,在PC上使用工具软件利用fastboot模式刷机,恢复recovery。线刷所有操作在XP下更可靠,win7不一定成功,线刷的软件估计是以 Windows XP 系统为标准开发的。

Labels: , ,

Wednesday, May 17, 2017

关于apt-get安装与pip安装

python的package/lib可以使用python的包管理工具pip安装,也可以通过Linux系统的软件管理工具apt-get等安装,根据经验来说apt-get提供的版本没有pip新(例如安装pip本身,apt-get得到的版本太旧,只能用pip提供的get-pip.py安装),但apt-get比较强大可以安装相关的依赖,库也比较全,一条命令即可,不用操心依赖;pip虽然装的版本新,但缺少相关依赖,需要自己操心依赖,而且有些东西pip并不提供,必须apt-get,例如 tkinter ,参考: https://community.c9.io/t/installing-tkinter-library-in-python-2-7/10931 http://stackoverflow.com/questions/4783810/install-tkinter-for-python 必须 sudo apt-get install python-tk (此命令适用python2;python3需要用python3-tk)

Labels: , ,

Saturday, May 13, 2017

使Ubuntu默认启动进入命令行

Ubuntu 14.04 server,原无GUI,安装gnome之后,默认进入GUI,现需更改默认进入文本模式,进行如下操作:
1. 编辑/etc/default/grub,将 GRUB_CMDLINE_LINUX_DEFAULT="**" 更改为: GRUB_CMDLINE_LINUX_DEFAULT="text";
2. 更新grub: sudo update-grub 。
以后重启便直接进入 text mode 文本模式,如需开启GUI,直接在console运行 startx ,或者在远程(如putty)中运行 sudo startx ,注意 ~/.Xauthority 权限,需要本用户,如果为root,可直接删掉
参考:
https://askubuntu.com/questions/16371/how-do-i-disable-x-at-boot-time-so-that-the-system-boots-in-text-mode

Labels: ,

Wednesday, May 10, 2017

ubuntu server 14.04 安装 图形界面 gnome

Ubuntu server 14.04 安装默认无图形界面,通过如下命令安装gnome图形界面:

sudo apt-get install ubuntu-gnome-desktop(运行前先sudo apt-get update更新源)
安装后是gnome 3

安装ubuntu-gnome-desktop时自动安装相关依赖,包括gnome-shell,以及office软件等等,如需尽量少装其他软件,可用:sudo apt-get install --no-install-recommends ubuntu-gnome-desktop

Labels: ,

Friday, May 5, 2017

关于Python中的引号

Python中,字符串用单引号'或双引号",但有时遇到无法识别字符串等等情况,可以尝试三引号或引号嵌套:
'''****'''
'"****"'
三引号是把全部内容当做文本,引号嵌套可以识别路径中的空格,尤其是Windows中C:\Program Files\ 这些

Labels: , , , ,

Sunday, March 12, 2017

coursera-dl工具介绍

https://www.coursera.org 是在线学习网站,由Stanford University的 Daphne Koller 和 Andrew Ng(吴恩达) 创办,其中的课程比较不错,例如 Daphne Koller 的 Probabilistic Graphical Models,Andrew Ng 的 Machine Learning 不错,两门课程都是AI人工智能相关。课程内容托管在Amazon云服务上,由于大陆访问Amazon的云不是很顺畅,所以对课程学习有一些影响,解决方法可以用工具解析出正确的服务地址IP后,写到hosts文件中,或者下载课程内容,包括视频等。这里coursera-dl就是一个不错的download下载工具,它基于Python,建议Python3,使用pip安装好之后,直接运行: coursera-dl -u email(username) -p (password) --path=.(where to download) machine-learning(course name) 官方网址: https://github.com/coursera-dl/coursera-dl https://github.com/coursera-dl https://github.com/coursera-dl/coursera-dl/blob/master/README.md 里面还有另一个工具: https://github.com/coursera-dl/edx-dl 是针对另一个在线学习网址 edx 的。 下载的时候在目录下面生成文件 ****-syllabus-parsed.json (例如 machine-learning-syllabus-parsed.json) 下载如果卡住,可 Ctrl+C 强行终止后,在同一路径再次运行同一命令继续下载(程序错误退出也可以这样继续),之前已下载过的、重复的就不会下载

Labels: , , ,

Sunday, February 19, 2017

office2016及visio2016的安装

新版本office不像以前的版本可以自定义安装界面供用户选择,而是点击安装后自动在后台运行,一键安装完毕,如果需要自定义,则需要下载一个工具officedeploymenttool_7614-3602.exe(Office 2016 Deployment Tool)下载地址: https://www.microsoft.com/en-us/download/details.aspx?id=49117 下载完毕后运行会让用户选择一个目录,它自动把两个文件(setup.exe、configuration.xml)解压到指定目录,编辑 configuration.xml 这个文本文件,填好相关自定义内容,再执行 setup.exe 即可自定义安装,此外还可以同时安装office和visio。之前为了同时安装office和visio下载了 cn_office_professional_plus_2016_x86_x64_dvd_6969182.iso 和 cn_visio_professional_2016_x86_x64_dvd_6970929.iso ,只执行前者,是没有visio的,需要运行两个,但实际上两个iso大小几乎一样,里面的内容估计都已经自带。使用 officedeploymenttool_7614-3602.exe 解压出来的 setup.exe 和 configuration.xml,执行 setup.exe /configure configuration.xml ,(管理员权限命令行,或者普通权限会自动弹出是否允许),注意xml里面的路径需要可识别,开始尝试 E:\某中文名文件夹\...\cn_visio_professional_2016_x86_x64_dvd_6970929\ ,结果出现提示 error code 0-1008(0) (officedeploymenttool_7614-3602.exe解压到同一目录运行时没这个错误),于是直接放到E盘下: E:\cn_visio_professional_2016_x86_x64_dvd_6970929\ ,里面的 是注释,OfficeClientEdition选择64位版本还是32位版本。参考: http://blog.sina.com.cn/s/blog_a652eb210102wkd4.html http://blog.sina.com.cn/s/blog_489988100102w4mf.html https://answers.microsoft.com/en-us/msoffice/forum/msoffice_install-mso_win10/why-doesnt-office-2016-pro-plus-setup-give-you-the/46217e78-fc40-41f8-81a7-1eb122a1bdde https://technet.microsoft.com/en-us/library/jj219423(v=office.15)?f=255&MSPPError=-2147217396 https://technet.microsoft.com/en-us/library/jj219426 简单总结一下过程: 1.下载 cn_visio_professional_2016_x86_x64_dvd_6970929.iso 解压到可识别目录例如 E:\cn_visio_professional_2016_x86_x64_dvd_6970929\,同时下载 officedeploymenttool_7614-3602.exe 运行解压到某目录; 2.编辑 officedeploymenttool_7614-3602 的 configuration.xml ,修改相关内容,如32还是64位版本,安装源所在路径,语言,安装产品(VisioProRetail、proplusretail),安装哪些组件、排除哪些组件等; 3.运行 officedeploymenttool_7614-3602 的 setup.exe 一键安装,具体命令:setup.exe /configure configuration.xml ,最后进行破解使用。 以下是本次安装使用的 configuration.xml (仅供参考): 最后附一个Microsoft软件下载网站: http://msdn.itellyou.cn/

Labels: ,

Wednesday, February 15, 2017

putty color scheme(putty配色方案)

参考: https://darekkay.com/2015/03/21/my-putty-color-scheme/ putty自带配色不太好用,特别是紫色,时间长了闪瞎眼,手动设置可以在 window -> colours 里面调整,但是太麻烦,可以直接把相关的 **.reg 导入Windows注册表即可,于是上网搜了下网友给出的诸多 color scheme,发现如下方案比较好(https://darekkay.com/2015/03/21/my-putty-color-scheme/): Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\SESSION_NAME] ; Default Foreground "Colour0"="217,216,216" ; Default Bold Foreground "Colour1"="217,216,216" ; Default Background "Colour2"="28,28,28" ; Default Background "Colour3"="28,63,149" ; Cursor Text "Colour4"="28,28,28" ; Cursor Color "Colour5"="231,231,232" ; ANSI Black "Colour6"="115,113,113" ; ANSI Black Bold "Colour7"="115,113,113" ; ANSI Red "Colour8"="251,38,8" ; ANSI Red Bold "Colour9"="251,38,8" ; ANSI Green "Colour10"="167,226,46" ; ANSI Green Bold "Colour11"="167,226,46" ; ANSI Yellow "Colour12"="102,217,238" ; ANSI Yellow Bold "Colour13"="102,217,238" ; ANSI Blue "Colour14"="0,157,220" ; ANSI Blue Bold "Colour15"="0,157,220" ; ANSI Magenta "Colour16"="255,85,255" ; ANSI Magenta Bold "Colour17"="255,85,255" ; ANSI Cyan "Colour18"="255,210,4" ; ANSI Cyan Bold "Colour19"="255,210,4" ; ANSI White "Colour20"="217,216,216" ; ANSI White Bold "Colour21"="255,255,255" 其中的 SESSION_NAME 替换为session名,如果注入默认设置,可将 SESSION_NAME 替换为 Default%20Settings 以上是有注释的,去掉注释的版本为: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\SESSION_NAME] "Colour0"="217,216,216" "Colour1"="217,216,216" "Colour2"="28,28,28" "Colour3"="28,63,149" "Colour4"="28,28,28" "Colour5"="231,231,232" "Colour6"="115,113,113" "Colour7"="115,113,113" "Colour8"="251,38,8" "Colour9"="251,38,8" "Colour10"="167,226,46" "Colour11"="167,226,46" "Colour12"="102,217,238" "Colour13"="102,217,238" "Colour14"="0,157,220" "Colour15"="0,157,220" "Colour16"="255,85,255" "Colour17"="255,85,255" "Colour18"="255,210,4" "Colour19"="255,210,4" "Colour20"="217,216,216" "Colour21"="255,255,255"

Labels: , , ,

Tuesday, February 14, 2017

MySQL的迁移

前天从原Ubuntu把某数据库迁移到新装Ubuntu虚拟机,开始以为每个数据库是一个独立文件夹,例如自带的 /var/lib/mysql/mysql/、/var/lib/mysql/performance_schema/,自己创建的数据库**,于是只迁移了**,其余没理,后来发现原来mysql中创建的用户没了,于是新建了用户: create user 'username'@'localhost' identified by 'password'; grant all privileges on name_of_db.* to 'username'@'localhost'; 接下来发现进去数据库**后能看到表,但是列不出表的内容,查了下,原来数据库内容不在**文件夹,仔细一看,**文件夹很小,几十万条数据不可能存在里面,一查原来mysql数据库默认都是放在 ibdata1 这个文件里面的,新ibdata1大小只有18M,原有ibdata1有90M。如果需要每个数据库单独存储,则需要设置,今天重新查了下,使用 show global variables; 里面显示的选项 innodb_file_per_table 默认 OFF,开启此项后默认存放在每个数据库的文件夹里,每个表单独一个文件。 于是将原有的 ibdata1 移动到新机,终于可以看到数据了,但是发现数据不全,前天睡前想了想,要仔细看下数据,看创建时间,以及对应的ID是否和log一致,昨天早上一看是OK的,之前吓了一跳,以为几个月来爬到的东西全没了。 总结下经验,移动数据库要么导出数据导入另一机器的数据库,或者使用mysql自带数据库迁移、复制之类的功能,要么将相关文件夹和文件全部移动或复制,包括 /var/lib/mysql/mysql/、/var/lib/mysql/performance_schema/、**自己的数据库、ibdata1、ib_logfile0、ib_logfile1,这些相关的文件都需要保留。

Labels: , ,

Monday, February 13, 2017

MySQL Connector/Python 的安装

MySQL Connector/Python 是Python的mysql驱动,安装这个驱动之后才能在Python中使用 import mysql.connector 并使用数据库,具体参见 https://dev.mysql.com/doc/connector-python/en/ 安装方法可以是apt,或者下载安装包。 先说说apt。Ubuntu默认是没有mysql-connector-python这些东西的,apt-cache search mysql-connector-python是没结果的,即使 sudo apt-get update 更新后也不行,mysql相关的东西需要安装 MySQL APT Repository 让apt知道mysql相关的东西后才能用apt安装 mysql-connector-python (参考 https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/ 、 https://dev.mysql.com/downloads/repo/apt/)。 另一种方式是下载安装包,Ubuntu是deb包(https://dev.mysql.com/downloads/connector/python/),命令 sudo dpkg -i PACKAGE.deb 安装。 以上两种是通过MySQL官网给出的安装方法,也可通过Python途径获取:使用Python安装工具pip安装。 不管是apt还是deb安装包,都有两种选择,一个是纯Python实现,另一种是C扩展实现,在操作数据量大的时候第二种效率高, import mysql.connector 默认使用第一种,连接数据库时 use_pure=False 表示使用第二种,或者直接 import _mysql_connector 使用第二种。参考(https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html 、 https://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html 、 https://dev.mysql.com/doc/connector-python/en/connector-python-cext.html)经过摸索,如果只装mysql-connector-python-cext,那么就只能使用 import _mysql_connector ,如果安装 mysql-connector-python ,则可使用 import mysql.connector ,两者都装,才可 import mysql.connector 后 设置 use_pure ,后面找了下,在这里有叙述对于Linux两个安装包是分开的,如需要则两个都要安装:https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html 由于自己的程序操作数据量暂不大,但考虑以后扩展性,最后选择 mysql-connector-python 和 mysql-connector-python-cext 都安装,但使用 import mysql.connector 且默认 use_pure

Labels: , , ,

Saturday, February 11, 2017

Ubuntu命令行以静默模式安装matlab

参考: https://zhuanlan.zhihu.com/p/23633624 (以此为准) http://m.sodocs.net/doc/3b1c7863a98271fe910ef927.html http://blog.csdn.net/wangpengfei163/article/details/47311041 虚拟机Ubuntu server无桌面,命令行静默模式(silent mode)安装matlab使用如下命令: sudo /media/cdrom/install -inputFile /home/alex/matlab/installer_input.txt 其中第一张(共两张)DVD sudo mount /dev/cdrom /media/cdrom/ 装入后,执行里面的/media/cdrom/install(网友建议不要在/media/cdrom目录执行install),inputFile为installer_input.txt,相关参数在里面,内容如下(井号为注释): ################################################################## ## ## Use this file to specify parameters required by the installer at runtime. ## ## Instructions for using this file. ## ## 1. Create a copy of this template file and fill in the required ## information. ## ## 2. Uncomment only those lines that start with a single '#' ## and set the desired values. All allowed values for the ## parameters are defined in the comments section for each ## parameter. ## ## 3. Launch the installer from the command line, using the -inputFile option ## to specify the name of your installer initialization file. ## ## (Windows) setup.exe -inputFile ## (Mac/Unix) install -inputFile ## ## NOTE: ## If you want to run the activation application in silent ## mode immediately after the installer completes, you must create ## an activation initialization file and specify its name as the ## value of the activationPropertiesFile= option. You can also ## pass the name of the activation initialization file to the ## installer using the -activationPropertiesFile command line ## option. ## ################################################################## ## ## ## SPECIFY INSTALLATION FOLDER ## ## Example: ## (Windows) destinationFolder=C:\Program Files\MATLAB\RXXXX ## (Unix) destinationFolder=/usr/local/RXXXX ## (Mac) destinationFolder=/Applications ## ## Set the desired value for destinationFolder and ## uncomment the line. # destinationFolder= ## ## SPECIFY FILE INSTALLATION KEY ## ## Example: fileInstallationKey=xxxxx-xxxxx-xxxxx-xxxxx..... ## ## Set the desired value for fileInstallationKey and ## uncomment the line. ## fileInstallationKey=09806-07443-53955-64350-21751-41297 ## ## ACCEPT LICENSE AGREEMENT ## ## You must agree to the license agreement to install MathWorks products. ## The license agreement can be found in the license_agreement.txt file at the ## root level of the installation DVD. ## ## Example: agreeToLicense=yes ## ## Set agreeToLicense value to yes or no and ## uncomment the line. agreeToLicense=yes ## ## SPECIFY OUTPUT LOG ## ## Specify full path of file into which you want the results of the ## installation to be recorded. ## ## Example: ## (Windows) outputFile=C:\TEMP\mathworks_.log ## (Unix/Mac) outputFile=/tmp/mathworks_.log ## ## Set the desired value for outputFile and ## uncomment the line. outputFile=/home/alex/matlab/mathworks_matlab_install.log ## SPECIFY INSTALLER MODE ## ## interactive: Run the installer GUI, waiting for user input on all ## dialog boxes. ## ## silent: Run the installer without displaying the GUI. ## ## automated: Run the installer GUI, displaying all dialog boxes, but only ## waiting for user input on dialogs that are missing required ## input. ## ## Set mode value to either interactive, silent, or automated and ## uncomment the line. mode=silent ## SPECIFY LENGTH OF TIME DIALOG BOXES ARE DISPLAYED ## ## Specify how long the installer dialog boxes are displayed, in milliseconds. ## ## NOTE: Use this value only if you set the installer mode to automated. ## ## By default, the dialog boxes display on the screen for one second. ## ## Example: (To specify a value of 1 second.) automatedModeTimeout=1000 ## ## Set the desired value for automatedModeTimeout and ## uncomment the line. # automatedModeTimeout= ## SPECIFY ACTIVATION PROPERTIES FILE (For non-network license types only) ## ## Enter the path to an existing file that contains properties to configure ## the activation process. activationPropertiesFile=/home/alex/matlab/activate.ini ########## Begin: Options for Network License Types ######### ## ## SPECIFY PATH TO LICENSE FILE (Required for network license types only) ## ## This value is required when installing either the License Manager or when ## installing as a Network End-User ## Example: ## (Windows) licensePath=C:\TEMP\license.dat ## (Unix) licensePath=/tmp/license.dat ## Set the desired value for licensePath and ## uncomment the line. # licensePath= ## CHOOSE TO INSTALL LICENSE MANAGER (For network license types only) ## ## Installs license manager files to disk. ## ## NOTE: You only need to install the license manager files ## on your license server. ## ## Set lmgrFiles value to true or false and ## uncomment the line. # lmgrFiles= ## INSTALL LICENSE MANAGER AS A SERVICE (For network license types only) ## ## Configure the license manager as a service on Windows. ## ## NOTE: Not applicable for Unix or Mac. ## ## NOTE: The lmgr_files option (set in previous step) must also be set to true. ## ## Set lmgrService value to true or false and ## uncomment the line. # lmgrService= ########## End: Options for Network License Types ######### ################# Begin - Windows Only Options ################ ## ## CHOOSE TO SET FILE ASSOCIATIONS ## ## Set to true if you want the installer to associate file types used by MathWorks ## products to this version of MATLAB, or false if you do not want the installer to ## associate MathWorks file types with this version of MATLAB. ## ## Default value is true. ## ## Set setFileAssoc value to true or false and ## uncomment the line. # setFileAssoc= ## ## CHOOSE TO CREATE WINDOWS DESKTOP SHORTCUT ## ## Set to true if you would like the installer to create a desktop shortcut icon ## when MATLAB is installed or false if you don't want the shortcut created. ## ## Set desktopShortcut value to true or false and ## uncomment the line. # desktopShortcut= ## CHOOSE TO ADD SHORTCUT TO WINDOWS START MENU ## ## Set to true if you would like the installer to create a Start Menu shortcut ## icon when MATLAB is installed or false if you don't want the shortcut created. ## ## Set startMenuShortcut value to true or false and ## uncomment the line. # startMenuShortcut= ## CREATE a MATLAB Startup Accelerator task ## ## The MATLAB Startup Accelerator installer creates a ## system task to preload MATLAB into the system▒s cache ## for faster startup. ## ## NOTE: By default, a MATLAB Startup Accelerator task will ## automatically be created. ## ## If you want a MATLAB Startup Accelerator task to be created, ## do not edit this section. ## ## Set createAccelTask value to false if you do not want to ## create an Accelerator task and uncomment the line. # createAccelTask= ## Enable Login Named User licensing ## ## Set to Yes to enable use of a Login Named User license for all users of this MATLAB installation ## Users must log in to their MathWorks Account when MATLAB starts. ## ## Example: enableLNU=yes ## ## NOTE: This flag is valid in silent installations only. # enableLNU=yes ################ End - Windows Only Options ################ ## SPECIFY PRODUCTS YOU WANT TO INSTALL ## ## By default, the installer installs all the products and ## documentation for which you are licensed. Products you are not licensed for ## are not installed, even if they are listed here. ## ## Note: ## 1. To automatically install all your licensed products, do not edit ## any lines in this section. ## ## 2. To install a specific product or a subset of products for ## which you are licensed, uncomment the line for the product(s) you want ## to install. #product.Aerospace_Blockset #product.Aerospace_Toolbox #product.Antenna_Toolbox #product.Audio_System_Toolbox #product.Bioinformatics_Toolbox #product.Communications_System_Toolbox #product.Computer_Vision_System_Toolbox #product.Control_System_Toolbox #product.Curve_Fitting_Toolbox #product.DO_Qualification_Kit #product.DSP_System_Toolbox #product.Data_Acquisition_Toolbox #product.Database_Toolbox #product.Datafeed_Toolbox #product.Econometrics_Toolbox #product.Embedded_Coder #product.Filter_Design_HDL_Coder #product.Financial_Instruments_Toolbox #product.Financial_Toolbox #product.Fixed_Point_Designer #product.Fuzzy_Logic_Toolbox #product.Global_Optimization_Toolbox #product.HDL_Coder #product.HDL_Verifier #product.IEC_Certification_Kit #product.Image_Acquisition_Toolbox #product.Image_Processing_Toolbox #product.Instrument_Control_Toolbox #product.LTE_System_Toolbox #product.MATLAB #product.MATLAB_Coder #product.MATLAB_Compiler #product.MATLAB_Compiler_SDK #product.MATLAB_Distributed_Computing_Server #product.MATLAB_Production_Server #product.MATLAB_Report_Generator #product.Mapping_Toolbox #product.Model_Predictive_Control_Toolbox #product.Model_Based_Calibration_Toolbox #product.Neural_Network_Toolbox #product.OPC_Toolbox #product.Optimization_Toolbox #product.Parallel_Computing_Toolbox #product.Partial_Differential_Equation_Toolbox #product.Phased_Array_System_Toolbox #product.Polyspace_Bug_Finder #product.Polyspace_Code_Prover #product.RF_Toolbox #product.Risk_Management_Toolbox #product.Robotics_System_Toolbox #product.Robust_Control_Toolbox #product.Signal_Processing_Toolbox #product.SimBiology #product.SimEvents #product.SimRF #product.Simscape #product.Simscape_Driveline #product.Simscape_Electronics #product.Simscape_Fluids #product.Simscape_Multibody #product.Simscape_Power_Systems #product.Simulink #product.Simulink_3D_Animation #product.Simulink_Code_Inspector #product.Simulink_Coder #product.Simulink_Control_Design #product.Simulink_Design_Optimization #product.Simulink_Design_Verifier #product.Simulink_Desktop_Real_Time #product.Simulink_PLC_Coder #product.Simulink_Real_Time #product.Simulink_Report_Generator #product.Simulink_Test #product.Simulink_Verification_and_Validation #product.Spreadsheet_Link #product.Stateflow #product.Statistics_and_Machine_Learning_Toolbox #product.Symbolic_Math_Toolbox #product.System_Identification_Toolbox #product.Trading_Toolbox #product.Vehicle_Network_Toolbox #product.Vision_HDL_Toolbox #product.WLAN_System_Toolbox #product.Wavelet_Toolbox 里面涉及的 activate.ini 内容为(同样的,井号为注释): ################################################################## # # Name: activate.ini # # Copyright 2008-2010 The MathWorks, Inc. # # Purpose: Activation application initialization file template. # Use this file to specify parameters required by the activation # application at runtime. This file provides the activation # application with required input without using the GUI. # # INSTRUCTIONS FOR RUNNING IN SILENT MODE # # To run the activation application in silent mode: # # 1. Create a copy of this template file and fill in the required # information. # # 2. Navigate to the folder containing the activation application. # (Windows) $MATLABROOT\bin\$ARCH # (Mac/Linux) $MATLABROOT/bin # # 3. Launch the activation application from the command line, # using the -propertiesFile option to specify the name of your # activation initialization file. # # (Windows) activate_matlab.exe -propertiesFile # (Mac/Linux) activate_matlab.sh -propertiesFile # # NOTE: If you want to perform silent activation automatically # after performing silent installation, specify the name of your # activation initialization file as the value of the # activationPropertiesFile= option in the installer initialization # file (installer_input.txt). This option causes the installer # to launch the activation application in silent mode. You can # also specify the activation initialization file as an argument # when you launch the installer, using the -activationPropertiesFile # option. # # NOTE: When run in silent mode, the activation application does # not display the activation dialog boxes. # ################################################################## # # SPECIFY ACTIVATION MODE # # Specify whether or not to run in silent mode. # # Valid values: true / false # # Default: isSilent=true. isSilent=true # # SPECIFY ACTIVATION TYPE (Required) # # Specify the type of activation you want to do. # # Valid values: activateDcAnon / activateOffline activateCommand=activateOffline # # SPECIFY LICENSE FILE LOCATION (Required if activateCommand=activateOffline) # # If you specified the activation type activateOffline, you # must specify the location of the License File that you want # to install. # # Mac/Linux example: # licenseFile=/Central/license.dat # # Windows example: # licenseFile=C:\license.dat licenseFile=/home/alex/matlab/crack/license_standalone.lic # # SPECIFY ACTIVATION KEY (Required if activateCommand=activateDcAnon) # # If you specified the activation type activateDcAnon,you must # specify a valid Activation Key. # # Example: activationKey=55555-55555-55555-55555 activationKey= # # SPECIFY LICENSE FILE DESTINATION DIRECTORY (Optional) # # Specify the directory into which you want to install the license file. # You must specify the full path of a directory that already exists. # # NOTE: This option is only for advanced users since it could make MATLAB # unable to start without specifying special options. # # Mac/Linux example: # installLicenseFileDir=/Central/LicenseDirectory # # Windows examples: # installLicenseFileDir=C:\License Directory installLicenseFileDir= # # SPECIFY NAME OF INSTALLED LICENSE FILE (Optional) # # Specify the name of the installed License File. The file name # must have with either .lic or .dat file extension. # # Example: installLicenseFileName=license.dat installLicenseFileName= 相关日志记录在 mathworks_matlab_install.log 中,中途换上第二张DVD: sudo umount /media/cdrom 以及 sudo mount /dev/cdrom /media/cdrom/ 接下来是激活,将crack/R2016b/bin/glnxa64/里的4个lib:libcufft.so.7.5.18、libinstutil.so、libmwlmgrimpl.so、libmwservices.so复制到/usr/local/MATLAB/R2016b/bin/glnxa64/(/usr/local/MATLAB/R2016b/是默认安装目录,注意复制后的文件权限),同时将crack/license_standalone.lic复制到/usr/local/MATLAB/R2016b/licenses/(licenses目录是自己创建的,注意目录权限,命令:sudo cp license_standalone.lic /usr/local/MATLAB/R2016b/licenses),即可运行matlab了:sudo /usr/local/MATLAB/R2016b/bin/matlab,但此时bin目录不在环境变量中,无法直接使用matlab。 后记20170212: 1.执行 sudo chmod -R a+rX R2016b/ (-R表示递归,a表示所有用户包括u(ser)、g(roup)、o(ther),+rX表示增加读权限、可执行权限,大写X表示在此条件下增加可执行权限:目标为目录或对某用户已经具有可执行权限execute/search only if the file is a directory or already has execute permission for some user),使所有用户均有权限访问matlab目录,并可使用matlab; 2.执行 sudo ln -s /usr/local/MATLAB/R2016b/bin/matlab /usr/local/bin/matlab 使matlab命令可直接执行,不用指定具体路径,因为/usr/local/bin已包含在环境变量$PATH中;或者将 /usr/local/MATLAB/R2016b/bin/ 添加至$PATH(可在~/.profile中添加)也可直接执行matlab;由于本机上 PATH="$HOME/bin:$PATH" 于是直接在~/bin/ 中创建软链接 ln -s /usr/local/MATLAB/R2016b/bin/matlab ~/bin/matlab 即可; 3.昨天在安装完matlab后,需root权限执行,于是给 /usr/local/MATLAB/R2016b/ 递归加上可读、可执行权限,但在加完r可读权限后,再看之前没权限的目录,例如ls -al **,内容全变为问号,开始以为出了啥差错,后来发现原来是文件夹有可读权限但没有可执行权限时,ls -al 该文件夹时,可以看到里面的文件,但显示出来的属性内容全为问号,只有该文件夹具备的可执行权限时,才看得到属性,也就是说,可读权限决定是否看得到内容,可执行权限决定是否看得到内容的属性; 4.安装完提示如下: Your installation may require additional configuration steps. 1. The following products require a supported compiler: Stateflow 8.8 Simulink Coder 8.11 MATLAB Coder 3.2 Simulink Test 2.1 2. Simulink requires a C compiler for simulation acceleration, model reference, and MATLAB Function Block capabilities. It is recommended that you install a supported compiler on your machine. 3. To accelerate computations with the following products, a supported compiler is required: SimBiology 5.5 Fixed-Point Designer 5.3 4. After this installation is complete, you should continue with your configuration of the MATLAB Distributed Computing Server as outlined in the instructions obtained from www.mathworks.com/distconfig. 5. MATLAB Compiler SDK 6.3 requires the following: ● a supported compiler for creation of C and C++ Shared libraries ● a Java JDK for creation of Java packages (Feb 11, 2017 22:16:24) Exiting with status 0 (Feb 11, 2017 22:16:39) End - Successful. VM Ubuntu 64 之前已安装好gcc、g++,Java也装了 (java -version 显示 : java version "1.7.0_121" OpenJDK Runtime Environment (IcedTea 2.6.8) (7u121-2.6.8-1ubuntu0.14.04.3) OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode) ) 使用如下两个命令重新配置下: /usr/local/MATLAB/R2016b/bin/mbuild -setup 输出: MBUILD configured to use 'gcc' for C language compilation. To choose a different language, execute one from the following: mex -setup C++ -client MBUILD mex -setup FORTRAN -client MBUILD 以及 /usr/local/MATLAB/R2016b/bin/mex -setup 输出: MEX configured to use 'gcc' for C language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. In the near future you will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html. To choose a different language, execute one from the following: mex -setup C++ mex -setup FORTRAN

Labels: ,

Ubuntu安装C/C++编译环境

Ubuntu(包括其他版本Linux)安装C/C++编译器/编译环境只需要安装build-essential即可,build-essential依赖make、gcc、g++等库,安装build-essential后这些自动安装好了,具体命令:sudo apt-get install build-essential ****@****:~$ apt-cache depends build-essential build-essential |Depends: libc6-dev Depends: libc6-dev Depends: gcc Depends: g++ Depends: make make:i386 Depends: dpkg-dev Conflicts: build-essential:i386

Labels: , ,

lvm硬盘的挂载

原虚拟机硬盘是逻辑卷lvm,启用新虚拟机后需要把原硬盘数据迁移过来,可以scp,但是有效率问题和权限问题,于是考虑直接挂载。 1.在新虚拟机添加原有虚拟机硬盘 2.新虚拟机未使用lvm所以默认没有装lvm2工具,使用sudo apt-get install lvm2安装(原虚拟机使用lvm于是默认安装lvm2工具 3.使用pvs或pvdisplay查看物理卷,使用vgs查看卷组,使用lvdisplay查看逻辑卷,其中逻辑卷状态为not available,/dev/下没有相关设备,于是使用sudo vgchange -ay /dev/ubuntu-vg激活,一次性激活了ubuntu-vg中的两个分区:root和swap_1 4.挂载:sudo mount /dev/ubuntu-vg/root /mnt 进入查看,文件属性都没变,所属用户名也没变,所有信息完全一样。

Labels: , ,

Friday, February 3, 2017

关于局域网、网卡的几个小问题

1. 两台机在同一局域网内,通过一台交换机连出去,其中一台还通过了一台家庭路由器,两台之间隔很长时间才能通一次,远程连过去之后过会就卡一阵,而在外网的VPN连过来两台机都顺畅,说明局域网这两台机之间的设备没有很及时的把数据包转发给另一台机。

2. 笔记本电池耗尽突然down机,开机后不能上网,没有显示无线网络,删除虚拟网卡之后,显示绿色一格一格信号上有个红叉,这种一般是笔记本网卡硬件开关没打开,打开之后还是不行,最后设备管理器里面删除设备及驱动,自动安装(可能是win7从自己备份的地方复制过来)驱动后OK

Labels: , ,

Friday, January 13, 2017

Python exception的一个小问题

最近编写了一个小程序去爬某网站,挨个挨个ID查询信息,各种异常exception考虑了,但这段时间发现运行一段时间之后就停住了,进程还在,但是从网卡状态看就不再有像心跳一样的网络请求了,Linux用top命令显示的CPU占用率也为0了,log里面也停住了,仔细检查,怀疑是except语句没理解透:except **** as ****:之后就是else:语句了,之前想当然的把else认为是包含except **** as ****:这种情况之外的所有情况,但实际上是没有异常的情况,正确的语句应该是: try: **** except **** as ****:(捕获某个异常) **** except:(之前就是缺少了这个部分) ****(捕获某个异常之外的所有未知异常) else:(正常情况,即无异常的情况) **** 加上except:这个部分后继续运行程序 之前程序卡主估计是出现了未知异常没有被捕获,这个异常又不能像error一样被抛出使程序停止运行,程序就卡在了那里 另外附上exception相关类的关系: https://docs.python.org/2.7/library/exceptions.html#exception-hierarchy


后记20170117:
今天程序又停了,回来仔细观察了下,在可能有问题的地方都加了logging,另外注意到每次出现这种情况的时候,再手动去访问网站,都是未登录的,说明cookie过期了,但直接使用过期的cookie是能够得到一个页面显示的,说明是另一种情况,即是cookie使用过程中过期(而不是一开始就过期),那么怀疑到是timeout相关设置,于是注意到一个地方:opener.open的时候,是否有超时?一查果然默认timeout为无限制,就是说会永远超时下去,_GLOBAL_DEFAULT_TIMEOUT=object(),是空的。

于是加上了timeout=30:response = opener.open(request, timeout=30) ,其实共有3中方法设置超时:

import socket              #method 1 to set timeout
socket.setdefaulttimeout(0.01)

urllib2.socket.setdefaulttimeout(0.01) #method 2

response = opener.open(request, timeout=10) #method 3
接下来再试试

Labels: , , ,

Saturday, December 31, 2016

linux下MySQL的使用

Ubuntu 14.04 64位,装有MySQL服务端和客户端,执行MySQL语句可以先登录后执行: mysql -ualex -p******(alex is username & ****** is password)或者不填密码,执行此语句后输入密码 登录后执行语句,语句结尾加“;”回车胡执行 或者直接在shell里面执行一条语句: mysql -ualex -p****** -e 'SHOW VARIABLES LIKE "version%"'(alex is username & ****** is password)或者不填密码,执行此语句后输入密码 单引号和双引号可以互换,SQL语句后面加不加“;”都行

Labels: ,

Sunday, December 25, 2016

安装pip与Scrapy遇到的问题

安装pip与Scrapy(具体过程参考官网、与: http://cuiqingcai.com/912.html http://pip-cn.readthedocs.io/en/latest/installing.html https://raw.github.com/pypa/pip/master/contrib/get-pip.py(GitHub官网脚本) https://github.com/pypa/pip )后,发现root权限执行pip、scrapy正常,而普通用户报错: 执行python -m pip -V提示/usr/bin/python: No module named pip 执行scrapy提示: Traceback (most recent call last): File "/usr/local/bin/scrapy", line 7, in from scrapy.cmdline import execute ImportError: No module named scrapy.cmdline 执行python -c "import pip; print(pip.__version__)"提示: Traceback (most recent call last): File "", line 1, in ImportError: No module named pip 执行pip提示: Traceback (most recent call last): File "/usr/local/bin/pip", line 7, in from pip import main ImportError: No module named pip 而/usr/local/bin/pip的第七行是“from pip import main” 在自己的py程序中手动import pip也不行,于是查看路径,print sys.path显示: ['/home/****/py', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/home/****/py/mymod'] 看了下,主要是/usr/lib/和/usr/local/lib/,pip和scrapy装在/usr/local/lib/,而这个目录下的文件和文件夹权限有些异常: alex@ubuntu:~$ ls -al /usr/local/lib/python2.7/dist-packages/ total 1176 drwxrwsr-x 56 root staff 4096 Dec 25 20:11 . drwxrwsr-x 4 root staff 4096 Dec 4 22:04 .. drwx--S--- 2 root staff 4096 Dec 4 22:17 attr drwx--S--- 2 root staff 4096 Dec 4 22:17 attrs-16.3.0.dist-info drwx--S--- 2 root staff 4096 Dec 4 22:09 certifi drwx--S--- 2 root staff 4096 Dec 4 22:09 certifi-2016.9.26.dist-info drwx--S--- 2 root staff 4096 Dec 4 21:58 cffi drwx--S--- 2 root staff 4096 Dec 4 21:58 cffi-1.9.1.dist-info -rwx--x--x 1 root staff 733736 Dec 4 21:58 _cffi_backend.so drwx--S--- 2 root staff 4096 Dec 4 22:17 constantly drwx--S--- 2 root staff 4096 Dec 4 22:17 constantly-15.1.0.dist-info drwx--S--- 4 root staff 4096 Dec 4 22:06 cryptography drwx--S--- 2 root staff 4096 Dec 4 22:06 cryptography-1.6-py2.7.egg-info drwx--S--- 2 root staff 4096 Dec 4 22:17 cssselect drwx--S--- 2 root staff 4096 Dec 4 22:17 cssselect-1.0.0.dist-info -rw------- 1 root staff 126 Dec 4 20:57 easy_install.py -rw------- 1 root staff 315 Dec 4 20:57 easy_install.pyc drwx--S--- 2 root staff 4096 Dec 25 19:48 enum drwx--S--- 2 root staff 4096 Dec 4 21:58 enum34-1.1.6.dist-info drwx--S--- 2 root staff 4096 Dec 4 21:58 idna drwx--S--- 2 root staff 4096 Dec 4 21:58 idna-2.1.dist-info drwx--S--- 3 root staff 4096 Dec 4 22:17 incremental drwx--S--- 2 root staff 4096 Dec 4 22:17 incremental-16.10.1.dist-info drwx--S--- 2 root staff 4096 Dec 4 21:58 ipaddress-1.0.17.dist-info -rw------- 1 root staff 80176 Dec 4 21:58 ipaddress.py -rw------- 1 root staff 75654 Dec 4 21:58 ipaddress.pyc drwx--S--- 2 root staff 4096 Dec 4 21:58 .libs_cffi_backend drwx--S--- 6 root staff 4096 Dec 4 21:23 lxml drwx--S--- 2 root staff 4096 Dec 4 21:23 lxml-3.6.4.dist-info drwx--S--- 3 root staff 4096 Dec 4 21:31 ndg drwx--S--- 2 root staff 4096 Dec 4 21:31 ndg_httpsclient-0.4.2-py2.7.egg-info -rw------- 1 root staff 346 Dec 4 21:31 ndg_httpsclient-0.4.2-py2.7-nspkg.pth drwx--S--- 2 root staff 4096 Dec 4 22:06 OpenSSL drwx--S--- 2 root staff 4096 Dec 4 22:17 parsel drwx--S--- 2 root staff 4096 Dec 4 22:17 parsel-1.1.0.dist-info drwx--S--- 10 root staff 4096 Dec 25 19:49 pip drwx--S--- 2 root staff 4096 Dec 4 20:57 pip-9.0.1.dist-info drwx--S--- 4 root staff 4096 Dec 4 20:57 pkg_resources drwx--S--- 5 root staff 4096 Dec 4 21:31 pyasn1 drwx--S--- 2 root staff 4096 Dec 4 21:31 pyasn1-0.1.9.dist-info drwx--S--- 2 root staff 4096 Dec 4 22:17 pyasn1_modules drwx--S--- 2 root staff 4096 Dec 4 22:17 pyasn1_modules-0.0.8.dist-info drwx--S--- 3 root staff 4096 Dec 4 21:58 pycparser drwx--S--- 2 root staff 4096 Dec 4 21:58 pycparser-2.17-py2.7.egg-info drwx--S--- 2 root staff 4096 Dec 4 22:17 pydispatch drwx--S--- 2 root staff 4096 Dec 4 22:17 PyDispatcher-2.0.5-py2.7.egg-info drwx--S--- 2 root staff 4096 Dec 4 22:06 pyOpenSSL-16.2.0.dist-info drwx--S--- 3 root staff 4096 Dec 4 22:17 queuelib drwx--S--- 2 root staff 4096 Dec 4 22:17 queuelib-1.4.2.dist-info drwx--S--- 20 root staff 4096 Dec 4 22:17 scrapy drwx--S--- 2 root staff 4096 Dec 4 22:17 Scrapy-1.2.1.dist-info drwx--S--- 2 root staff 4096 Dec 4 22:17 service_identity drwx--S--- 2 root staff 4096 Dec 4 22:17 service_identity-16.0.0.dist-info drwx--S--- 4 root staff 4096 Dec 4 20:57 setuptools drwx--S--- 2 root staff 4096 Dec 4 20:57 setuptools-30.1.0.dist-info drwx--S--- 2 root staff 4096 Dec 4 21:58 six-1.10.0.dist-info -rw------- 1 root staff 30098 Dec 4 21:58 six.py -rw------- 1 root staff 29545 Dec 4 21:58 six.pyc drwx--S--- 26 root staff 4096 Dec 4 22:17 twisted drwx--S--- 2 root staff 4096 Dec 4 22:17 Twisted-16.6.0-py2.7.egg-info drwx--S--- 2 root staff 4096 Dec 4 22:17 w3lib drwx--S--- 2 root staff 4096 Dec 4 22:17 w3lib-1.16.0.dist-info drwx--S--- 5 root staff 4096 Dec 4 20:57 wheel drwx--S--- 2 root staff 4096 Dec 4 20:57 wheel-0.29.0.dist-info alex@ubuntu:~$ ls -al /usr/local/lib/python2.7/dist-packages/pip ls: cannot open directory /usr/local/lib/python2.7/dist-packages/pip: Permission denied alex@ubuntu:~$ sudo ls -al /usr/local/lib/python2.7/dist-packages/pip [sudo] password for alex: total 420 drwx--S--- 10 root staff 4096 Dec 25 19:49 . drwxrwsr-x 56 root staff 4096 Dec 25 20:11 .. -rw------- 1 root staff 11910 Dec 4 20:57 basecommand.py -rw------- 1 root staff 8874 Dec 4 20:57 basecommand.pyc -rw------- 1 root staff 10465 Dec 4 20:57 baseparser.py -rw------- 1 root staff 10596 Dec 4 20:57 baseparser.pyc -rw------- 1 root staff 16474 Dec 4 20:57 cmdoptions.py -rw------- 1 root staff 15486 Dec 4 20:57 cmdoptions.pyc drwx--S--- 2 root staff 4096 Dec 4 20:57 commands drwx--S--- 2 root staff 4096 Dec 4 20:57 compat -rw------- 1 root staff 32171 Dec 4 20:57 download.py -rw------- 1 root staff 24968 Dec 4 20:57 download.pyc -rw------- 1 root staff 8121 Dec 4 20:57 exceptions.py -rw------- 1 root staff 12182 Dec 4 20:57 exceptions.pyc -rw------- 1 root staff 39950 Dec 4 20:57 index.py -rw------- 1 root staff 34576 Dec 4 20:57 index.pyc -rw------- 1 root staff 11348 Dec 4 20:57 __init__.py -rw------- 1 root staff 9163 Dec 4 20:57 __init__.pyc -rw------- 1 root staff 5626 Dec 4 20:57 locations.py -rw------- 1 root staff 4734 Dec 4 20:57 locations.pyc -rw------- 1 root staff 584 Dec 4 20:57 __main__.py -rw------- 1 root staff 477 Dec 4 20:57 __main__.pyc drwx--S--- 2 root staff 4096 Dec 4 20:57 models drwx--S--- 2 root staff 4096 Dec 4 20:57 operations -rw------- 1 root staff 10980 Dec 4 20:57 pep425tags.py -rw------- 1 root staff 9431 Dec 4 20:57 pep425tags.pyc drwx--S--- 2 root staff 4096 Dec 4 20:57 req -rw------- 1 root staff 156 Dec 4 20:57 status_codes.py -rw------- 1 root staff 386 Dec 4 20:57 status_codes.pyc drwx--S--- 2 root staff 4096 Dec 4 20:57 utils drwx--S--- 2 root staff 4096 Dec 4 20:57 vcs drwx--S--- 12 root staff 4096 Dec 4 20:57 _vendor -rw------- 1 root staff 32010 Dec 4 20:57 wheel.py -rw------- 1 root staff 25061 Dec 4 20:57 wheel.pyc 在自己的py程序中手动import enum(与pip都在/usr/local/lib/)也不行,于是怀疑整个/usr/local/lib/python2.7/dist-packages/目录都有问题,查了下,参考: https://groups.google.com/forum/#!topic/comp.lang.python/CfBiVvvFOdY 执行“chmod -R a+rX 目录**”解决(-R递归,a表示u用户g组o其他 这些所有角色,X和可执行权限x相关但不是所有都加: execute/search only if the file is a directory or already has execute permission for some user (X)),执行后: alex@ubuntu:~/py$ ls -al /usr/local/lib/python2.7/dist-packages total 1176 drwxrwsr-x 56 root staff 4096 Dec 25 20:11 . drwxrwsr-x 4 root staff 4096 Dec 4 22:04 .. drwxr-sr-x 2 root staff 4096 Dec 4 22:17 attr drwxr-sr-x 2 root staff 4096 Dec 4 22:17 attrs-16.3.0.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 22:09 certifi drwxr-sr-x 2 root staff 4096 Dec 4 22:09 certifi-2016.9.26.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 21:58 cffi drwxr-sr-x 2 root staff 4096 Dec 4 21:58 cffi-1.9.1.dist-info -rwxr-xr-x 1 root staff 733736 Dec 4 21:58 _cffi_backend.so drwxr-sr-x 2 root staff 4096 Dec 4 22:17 constantly drwxr-sr-x 2 root staff 4096 Dec 4 22:17 constantly-15.1.0.dist-info drwxr-sr-x 4 root staff 4096 Dec 4 22:06 cryptography drwxr-sr-x 2 root staff 4096 Dec 4 22:06 cryptography-1.6-py2.7.egg-info drwxr-sr-x 2 root staff 4096 Dec 4 22:17 cssselect drwxr-sr-x 2 root staff 4096 Dec 4 22:17 cssselect-1.0.0.dist-info -rw-r--r-- 1 root staff 126 Dec 4 20:57 easy_install.py -rw-r--r-- 1 root staff 315 Dec 4 20:57 easy_install.pyc drwxr-sr-x 2 root staff 4096 Dec 25 19:48 enum drwxr-sr-x 2 root staff 4096 Dec 4 21:58 enum34-1.1.6.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 21:58 idna drwxr-sr-x 2 root staff 4096 Dec 4 21:58 idna-2.1.dist-info drwxr-sr-x 3 root staff 4096 Dec 4 22:17 incremental drwxr-sr-x 2 root staff 4096 Dec 4 22:17 incremental-16.10.1.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 21:58 ipaddress-1.0.17.dist-info -rw-r--r-- 1 root staff 80176 Dec 4 21:58 ipaddress.py -rw-r--r-- 1 root staff 75654 Dec 4 21:58 ipaddress.pyc drwxr-sr-x 2 root staff 4096 Dec 4 21:58 .libs_cffi_backend drwxr-sr-x 6 root staff 4096 Dec 4 21:23 lxml drwxr-sr-x 2 root staff 4096 Dec 4 21:23 lxml-3.6.4.dist-info drwxr-sr-x 3 root staff 4096 Dec 4 21:31 ndg drwxr-sr-x 2 root staff 4096 Dec 4 21:31 ndg_httpsclient-0.4.2-py2.7.egg-info -rw-r--r-- 1 root staff 346 Dec 4 21:31 ndg_httpsclient-0.4.2-py2.7-nspkg.pth drwxr-sr-x 2 root staff 4096 Dec 4 22:06 OpenSSL drwxr-sr-x 2 root staff 4096 Dec 4 22:17 parsel drwxr-sr-x 2 root staff 4096 Dec 4 22:17 parsel-1.1.0.dist-info drwxr-sr-x 10 root staff 4096 Dec 25 19:49 pip drwxr-sr-x 2 root staff 4096 Dec 4 20:57 pip-9.0.1.dist-info drwxr-sr-x 4 root staff 4096 Dec 4 20:57 pkg_resources drwxr-sr-x 5 root staff 4096 Dec 4 21:31 pyasn1 drwxr-sr-x 2 root staff 4096 Dec 4 21:31 pyasn1-0.1.9.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 22:17 pyasn1_modules drwxr-sr-x 2 root staff 4096 Dec 4 22:17 pyasn1_modules-0.0.8.dist-info drwxr-sr-x 3 root staff 4096 Dec 4 21:58 pycparser drwxr-sr-x 2 root staff 4096 Dec 4 21:58 pycparser-2.17-py2.7.egg-info drwxr-sr-x 2 root staff 4096 Dec 4 22:17 pydispatch drwxr-sr-x 2 root staff 4096 Dec 4 22:17 PyDispatcher-2.0.5-py2.7.egg-info drwxr-sr-x 2 root staff 4096 Dec 4 22:06 pyOpenSSL-16.2.0.dist-info drwxr-sr-x 3 root staff 4096 Dec 4 22:17 queuelib drwxr-sr-x 2 root staff 4096 Dec 4 22:17 queuelib-1.4.2.dist-info drwxr-sr-x 20 root staff 4096 Dec 4 22:17 scrapy drwxr-sr-x 2 root staff 4096 Dec 4 22:17 Scrapy-1.2.1.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 22:17 service_identity drwxr-sr-x 2 root staff 4096 Dec 4 22:17 service_identity-16.0.0.dist-info drwxr-sr-x 4 root staff 4096 Dec 4 20:57 setuptools drwxr-sr-x 2 root staff 4096 Dec 4 20:57 setuptools-30.1.0.dist-info drwxr-sr-x 2 root staff 4096 Dec 4 21:58 six-1.10.0.dist-info -rw-r--r-- 1 root staff 30098 Dec 4 21:58 six.py -rw-r--r-- 1 root staff 29545 Dec 4 21:58 six.pyc drwxr-sr-x 26 root staff 4096 Dec 4 22:17 twisted drwxr-sr-x 2 root staff 4096 Dec 4 22:17 Twisted-16.6.0-py2.7.egg-info drwxr-sr-x 2 root staff 4096 Dec 4 22:17 w3lib drwxr-sr-x 2 root staff 4096 Dec 4 22:17 w3lib-1.16.0.dist-info drwxr-sr-x 5 root staff 4096 Dec 4 20:57 wheel drwxr-sr-x 2 root staff 4096 Dec 4 20:57 wheel-0.29.0.dist-info alex@ubuntu:~/py$ ls -al /usr/local/lib/python2.7/dist-packages/pip total 420 drwxr-sr-x 10 root staff 4096 Dec 25 19:49 . drwxrwsr-x 56 root staff 4096 Dec 25 20:11 .. -rw-r--r-- 1 root staff 11910 Dec 4 20:57 basecommand.py -rw-r--r-- 1 root staff 8874 Dec 4 20:57 basecommand.pyc -rw-r--r-- 1 root staff 10465 Dec 4 20:57 baseparser.py -rw-r--r-- 1 root staff 10596 Dec 4 20:57 baseparser.pyc -rw-r--r-- 1 root staff 16474 Dec 4 20:57 cmdoptions.py -rw-r--r-- 1 root staff 15486 Dec 4 20:57 cmdoptions.pyc drwxr-sr-x 2 root staff 4096 Dec 4 20:57 commands drwxr-sr-x 2 root staff 4096 Dec 4 20:57 compat -rw-r--r-- 1 root staff 32171 Dec 4 20:57 download.py -rw-r--r-- 1 root staff 24968 Dec 4 20:57 download.pyc -rw-r--r-- 1 root staff 8121 Dec 4 20:57 exceptions.py -rw-r--r-- 1 root staff 12182 Dec 4 20:57 exceptions.pyc -rw-r--r-- 1 root staff 39950 Dec 4 20:57 index.py -rw-r--r-- 1 root staff 34576 Dec 4 20:57 index.pyc -rw-r--r-- 1 root staff 11348 Dec 4 20:57 __init__.py -rw-r--r-- 1 root staff 9163 Dec 4 20:57 __init__.pyc -rw-r--r-- 1 root staff 5626 Dec 4 20:57 locations.py -rw-r--r-- 1 root staff 4734 Dec 4 20:57 locations.pyc -rw-r--r-- 1 root staff 584 Dec 4 20:57 __main__.py -rw-r--r-- 1 root staff 477 Dec 4 20:57 __main__.pyc drwxr-sr-x 2 root staff 4096 Dec 4 20:57 models drwxr-sr-x 2 root staff 4096 Dec 4 20:57 operations -rw-r--r-- 1 root staff 10980 Dec 4 20:57 pep425tags.py -rw-r--r-- 1 root staff 9431 Dec 4 20:57 pep425tags.pyc drwxr-sr-x 2 root staff 4096 Dec 4 20:57 req -rw-r--r-- 1 root staff 156 Dec 4 20:57 status_codes.py -rw-r--r-- 1 root staff 386 Dec 4 20:57 status_codes.pyc drwxr-sr-x 2 root staff 4096 Dec 4 20:57 utils drwxr-sr-x 2 root staff 4096 Dec 4 20:57 vcs drwxr-sr-x 12 root staff 4096 Dec 4 20:57 _vendor -rw-r--r-- 1 root staff 32010 Dec 4 20:57 wheel.py -rw-r--r-- 1 root staff 25061 Dec 4 20:57 wheel.pyc 普通用户可执行pip、scrapy,而且原有/usr/local/lib/python2.7/dist-packages 整个目录及子目录均可让普通用户访问了,解决了之前一直存在但一直没发现的问题 后记20170211: 1.虚拟机安装新系统Ubuntu 14.04.5,/usr/local/lib/python2.7/dist-packages 和 /usr/local/lib/python3.4/dist-packages 均为空,且属性为root:staff 2.安装pip与scrapy时会有一些小问题,安装好相关的依赖就可以了,例如sudo apt-get install gcc、g++、libssl-dev、libffi-dev、python-dev,以及pip install pyopenssl、pyasn1、ndg-httpsclient、lxml、twisted 3.此次安装又遇到了另一个问题,运行scrapy提示: Traceback (most recent call last): File "/usr/local/bin/scrapy", line 7, in from scrapy.cmdline import execute File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 9, in from scrapy.crawler import CrawlerProcess File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 7, in from twisted.internet import reactor, defer File "/usr/local/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 38, in from twisted.internet import default File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 56, in install = _getInstallFunction(platform) File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction from twisted.internet.epollreactor import install File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 24, in from twisted.internet import posixbase File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 18, in from twisted.internet import error, udp, tcp File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 28, in from twisted.internet._newtls import ( File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 63, in from twisted.internet._sslverify import _setAcceptableProtocols File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_sslverify.py", line 38, in TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1, AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1' 查了下很有可能是twisted版本与scrapy不匹配导致,原有Ubuntu上scrapy是1.2.1,twisted是16.6.0,而新Ubuntu上scrapy是1.3.1,twisted是17.1.0,于是 sudo pip uninstall twisted(卸载) sudo pip install twisted==16.6.0(指定版本安装) sudo pip show twisted(查询) sudo chmod -R a+rX /usr/local/lib/python2.7/dist-packages/(更改相关文件夹权限) 后再次运行scrapy就OK 后记20170226: 昨天和今天继续整了下Python2、Python3以及pip、pip3 Python2和Python3可以看做两个独立的软件,pip作为Python的模块可以安装在Python2(/usr/local/lib/python2.7/dist-packages/)也可以安装在Python3(/usr/local/lib/python3.4/dist-packages/),执行pip和pip3分别为Python何Python3安装模块,也会默认安装到对应的这两个不同路径中,而查询的时候,例如pip/pip3 show coursera-dl,pip和pip3显示的结果是一样的,不管是2还是3版本的模块都能显示。默认安装模块后普通用户没有权限,主要是/usr/local/lib/python2.7/dist-packages/、/usr/local/lib/python3.4/dist-packages/,以及/usr/local/bin/这几个路径里的文件没权限,使用这些命令增加权限:sudo chmod -R a+rx /usr/local/bin/ 、 sudo chmod -R a+rX 目录 ,sudo chmod -R a+x *py 、sudo chmod -R a+x *pyc ,注意小写x是所有全加可执行权限,大写X是如果owner有x或者是目录,则加x;而 sudo chmod -R a+x *py 只能对当前目录的*py增加x,如果下一级子目录,需要 sudo chmod -R a+x */*py ,再下一级则需 sudo chmod -R a+x */*/*py ,增加权限后就可以不加sudo执行/查看了。另外需要注意的是apt-get安装的python3-pip版本太旧没法用,需要用官方的get-pip.py或者源码编译。而且Ubuntu14.04自带Python3.4但没见有pip3需手动装。整好后 python -m pip 和 python3 -m pip 都可以用了,python -m pip list 和 python3 -m pip list 可以分别列出2和3版本安装的模块。 理一下过程: coursera-dl作为Python模块,建议装在Python3目录,而自己的系统默认Python2,直接把Python命令指向Python3就可以直接安装pip到Python3对应路径,但会影响全局,影响其他程序,更好的方法是下载get-pip.py(https://bootstrap.pypa.io/get-pip.py),修改第一行 #!/usr/bin/env python 为 #!/usr/bin/env python3 (加一个3),这样 sudo ./get-pip.py 即可作为Python3的模块安装到 /usr/local/lib/python3.4/dist-packages/ ,接下来使用pip3安装coursera-dl:sudo pip3 install coursera-dl (或者 sudo python3 -m pip install ** 指定Python3的模块pip去install),也是直接装到 /usr/local/lib/python3.4/dist-packages/ ,注意增加相关目录权限。接下来就可以使用Python3的模块coursera-dl了(命令在/usr/local/bin/coursera-dl,相关文件在/usr/local/lib/python3.4/dist-packages/)。 后记20170516: 这几天安装TensorFlow遇到一些问题,走了一大圈弯路,细节省略了,大致过程如下: Ubuntu14.04装了Python2.7.6想安装最新的2.7.13,apt-get源里面没有,于是从源码安装,哪知道安装的路径不一致,原有在/usr/bin/、/usr/lib/ 这些目录里,新装的在/usr/local/bin/、/usr/local/lib/里面,导致一系列问题,源码命令没有卸载命令,只能手动一点点删,删完再重新试着安装2.7.6,重新pip: 起因是想装TensorFlow,因为主用Python2.7(2.7.6,虽然也装了Python3),所以想把2.7.6升到最新的2.7.13,以为这样可以避免Python的SNIMissingWarning和InsecurePlatformWarning告警(事实上怎么折腾还是没法避免)。但是apt源里面最新的就是2.7.6没法升,于是就下载了2.7.13源码编译安装,装好之后用pip安装TensorFlow,装好后import tensorflow告警: No module named tensorflow /usr/local/lib/python2.7/dist-packages/tensorflow 查看/usr/local/lib/python2.7/dist-packages/里面明明是有这个tensorflow文件夹啊,于是 print sys.path : ['/home/****', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages'] (或者 #!/usr/bin/env python # -*- coding: utf-8 -*- import sys print '\n'.join(sys.path) 分行显示 而使用 #!/usr/bin/env python 与 #!/usr/local/bin/python 与 #!/usr/bin/python 与 #!/usr/bin/python3 的结果不尽相同,/usr/bin/ 里是原来装的python,/usr/local/bin/ 里是新的、源码安装的python。 ) sys.path和原来不一样,/usr/lib/ 变为了 /usr/local/lib/ 而且 dist-packages 变为了 site-packages ,这就是源码安装和apt-get安装造成的差异,怎么办? 有人建议装 virtualenv (参考:https://github.com/tensorflow/tensorflow/issues/647),这个 virtualenv 帮助管理路径,但我不想装,想自己掌握操作,于是试着添加路径到sys.path,不是在**.py里面临时sys.path.append,而是永久增加,参考: https://askubuntu.com/questions/798382/cant-import-installed-packages-in-python https://leemendelowitz.github.io/blog/how-does-python-find-packages.html https://docs.python.org/2/tutorial/modules.html (里面搜索 sys.path) https://docs.python.org/2/library/sys.html#sys.path https://docs.python.org/2/library/site.html#module-site http://www.tuicool.com/articles/EB3miqr http://www.jb51.net/article/42183.htm 选择在 site-packages 目录下加 ****.pth 文件的方法,创建 mypath.pth 里面写上目录,路径可以用相对路径,如果同一目录,直接文件名也可,添加之后 sys.path 确实有增加****.pth里的内容,现在sys.path的问题看起来解决了,但是import tensorflow仍然有问题: ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try `git clean -xdf` (removes all files not under version control). Otherwise reinstall numpy. 参考: https://github.com/tensorflow/tensorflow/issues/559 http://stackoverflow.com/questions/34051737/numpy-core-multiarray-failed-to-import http://stackoverflow.com/questions/20518632/importerror-numpy-core-multiarray-failed-to-import 还是版本冲突的问题,一下也找不出哪儿装了两个版本的numpy了,于是考虑卸载源码安装的Python2.7.13,但是源码目录里面没有卸载选项,只能手动删除: /usr/local/bin/python* /usr/local/bin/pydoc2 /usr/local/lib/python2 /usr/local/include/python2 /usr/local/lib/pkgconfig/python2.pc /usr/local/lib/libpython2 删除和以上类似的路径和文件后,/usr/local/bin/ 里面仍有一些文件,看了下有些是pip安装的Python包,例如pillow(PIL),产生的,于是直接删掉,找了会也没法100%确认干净,算了(期间误删了一些lib、pip文件,只好从另一个系统里复制过来一遍) 接下来,恢复安装Python2.7.6(其实原本就有,现在是重新安装、修复下,以免缺少文件之类的),这之前要添加第三方apt源(ppa),参考: https://www.zhihu.com/question/37021474?sort=created https://launchpad.net/ubuntu/+ppas?name_filter=python https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes https://askubuntu.com/questions/865554/how-do-i-install-python-3-6-using-apt-get 执行: sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update 再执行: sudo apt-get install --reinstall python2.7 sudo apt-get install --only-upgrade python2.7 sudo apt-get -f install python2.7 然后再apt-get装Python3.6,再从 https://pip.pypa.io/en/stable/installing/ 下载get-pip.py安装pip: python2 get-pip.py,下载 https://bootstrap.pypa.io/3.4****(try3.2、3.3/3.4、etc)/get-pip.py 来安装pip3: python3 get-pip.py(将get-pip.py首行改为:#!/usr/bin/env python3,注意写明python3而不是python),接下来又出现: File "get-pip.py", line 20061, in lsb_release ****的问题,查了下是lsb_release的问题,看到某网友 which lsb_release (查看lsb_release程序所在位置),于是 vi lsb_release 进去看了看,第一行是: #! /usr/bin/python3 -Es 修改Python3为python,再执行就OK了,看来还是安装Python3或者pip3时把 lsb_release 覆盖了,还是版本2和3的冲突。参考: https://github.com/pypa/setuptools/issues/937 https://discourse.mailinabox.email/t/unable-to-run-mailinabox-command/1840/11 (居然有网友卸载了重装来解决。。。。) 这个问题解决后接下来把pip和python指向2版本的可执行文件(通过强制修改软链接 ln -sf),但是每次pip之后还是需要修改 /usr/local/lib/python2.7/dist-packages 目录的权限很麻烦,查了下解决方法: http://stackoverflow.com/questions/23629898/problems-installing-matplotlib-in-linux http://caligari.treboada.net/2014/09/23/python-pip-and-the-staff-group/ https://askubuntu.com/questions/736738/i-tried-to-install-python-package-then-some-error-is-showing-like-exeption https://github.com/sindresorhus/weechat-notification-center/issues/1 https://superuser.com/questions/272061/reload-a-linux-users-group-assignments-without-logging-out https://arkaitzj.wordpress.com/2010/03/08/linux-add-user-to-a-group-without-logout/ 有把当前用户加入staff组的、有修改目录所有者、修改目录权限的,有用apt-get代替pip安装的,还有使用 virtualenv 的,试了下加入staff组然后 newgrp staff 不logout就即时生效,不好使,还是用 sudo pip **** 然后 sudo chmod -R a+rX /usr/local/lib/python2.7/dist-packages/ 。 最终的 sys.path 是(分行显示): /home/**** /usr/lib/python2.7 /usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages 而 from distutils.sysconfig import get_python_lib print(get_python_lib()) 是 /usr/lib/python2.7/dist-packages 最后参考 https://github.com/martin-gorner/tensorflow-mnist-tutorial/blob/master/INSTALL.txt 进行测试: git clone https://github.com/martin-gorner/tensorflow-mnist-tutorial.git cd tensorflow-mnist-tutorial python mnist_1.0_softmax.py 提示 ImportError: No module named _tkinter, please install the python-tk package 缺少tkinter库于是执行sudo apt-get install python-tk,OK 终于基于python2.7.6成功安装TensorFlow,同时保持了python2和python3并存,pip2和pip3并存 中间的小问题省略了,最后总结的经验就是: 尽量别源码安装python,可以用第三方源加入PPA后(可用ppa:fkrull/deadsnakes),用apt-get等工具安装新版本,没有最新的就算了。装好python再用pip安装package或lib,装完 sudo chmod -R a+rX /****/lib/****/dist-packages/ tensorflow的安装可参考: https://github.com/martin-gorner/tensorflow-mnist-tutorial/blob/master/INSTALL.txt sudo -H apt-get install git sudo -H pip install --upgrade matplotlib sudo -H pip install --upgrade tensorflow (缺少tkinter库需执行sudo apt-get install python-tk)

Labels: , , ,

Saturday, December 24, 2016

VMware的vmem文件失效清理

VMware guestOS从一台电脑挪到另一台电脑后,发现原有vmem文件(大小和当时所分配的内存一样)及对应文件夹很久都没有被修改过了,而另外有一个**.vmem和文件夹 是实时被修改的,怀疑原有的失效,而且在很久以前,于是尝试着删除并运行虚拟机,一切正常 总结:由于种种原因(例如怀疑重装VMware等)VMware会产生vmem及文件夹垃圾文件,vmem占用大小和内存一样,这时可删除之 后记20170220: 除vmem文件外,wmdk文件也容易产生垃圾,虽然并不一定占用空间。例如在删除虚拟机附带的另一个虚拟磁盘(虚拟机名为 Ubuntu 64 ,虚拟机自带的第一个虚拟磁盘是虚拟文件,对应的文件为 Ubuntu 64.vmdk 和 Ubuntu 64-s001.vmdk、Ubuntu 64-s002.vmdk、Ubuntu 64-s003.vmdk 等,而另一个虚拟盘为计算机硬盘的最后一个物理分区,对应配置文件为 Ubuntu 64-0.vmdk 和 Ubuntu 64-0-pt.vmdk ,可在虚拟机里自由删除和添加 )后,对应的文件 Ubuntu 64-0.vmdk 和 Ubuntu 64-0-pt.vmdk 并没有被删除,下次添加时会从下一个编号开始,例如 Ubuntu 64-1.vmdk 和 Ubuntu 64-1-pt.vmdk ,删除/添加操作一次就产生了多余的两个文件,虽然文件很小。可以在虚拟机删除盘后手动删除这两个文件,再添加新盘,新的配置文件就和原来的名字一样 Ubuntu 64-0.vmdk 和 Ubuntu 64-0-pt.vmdk ,不会产生垃圾文件。

Labels: , , ,