Tag Info

New answers tagged

0

Put incidentally to write my environment On the assumption #CUDA is that it is installed properly CUDA Relationship of PATH (by rewriting your environment) CUDA_ROOT=/usr/local/cuda-7.0 PATH=$PATH:/usr/local/cuda-7.0/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-7.0/lib64:/usr/local/cuda-7.0/lib CPATH=$CPATH:/usr/local/cuda-7.0/include ...


0

I was also plagued by the same error. Perhaps you also pycuda is not installed properly. instead pip, please try to install the pycuda from the source. If pycuda can not be installed from the source, there is a risk such as the path of CUDA itself is funny. Eventually Ubuntu14.04, we have been successful in the construction of pycuda and chainer ...


0

You say you installed "dbus package". Which one? There's python-dbus and python3-dbus. I found this question because I faced the same issue with another software package, and the reason was that while I did have python-dbus installed, I did not have python3-dbus.


0

Solved in comments by OP: I've fixed this issue by running sudo python manage.py runserver instead of python manage.py runserver.


3

Take a look at http://www.cyberciti.biz/open-source/command-line-hacks/linux-run-command-as-different-user/ then just write a sh script which you chmod +x so that you can execute it then just use the script to launch the other script.


1

"Temporary failure in name resolution" means your connection dropped. Try again over wired Internet, or on a different network.


0

Try sinippy: http://leon.vankammen.eu/tech/snippy-autocompletion-for-console-and-browser-window-manager-using-bash.html or snippely: https://code.google.com/p/snippely/ Other answers on SO might also be helpful to you: http://stackoverflow.com/questions/4175501/best-way-to-manage-code-snippets-in-linux


2

To me the only difference is the scheme path. Using sudo your package will be installed in: /usr/local/lib/python2.7/dist-packages/ With --user they are installed in your $HOME directory in: $HOME/.local/lib/python2.7/site-packages For your own system, I'd say it does not really matter. Use --user if you're not a sudoer member. For code you publish, ...


1

I used to have these problems when configuring python with --enable-shared and the python executable would find and load the installed /usr/lib/x86_64-linux-gnu/libpython2.7.so. Removing that option from the configuration helped solve the problem.


2

The terminal in Ubuntu (like most other Linux distributions) uses bash which can be used to perform tasks and functions programmatically. Python also comes with most Linux distributions but it is not "burned" into Linux like bash is. You can use python to interact with your computer by using libraries such as os but for most tasks you may be better off ...


3

Understanding what the script should do I am afraid you are misunderstanding how the script should be applied. There is no reason to have another script write this script into a file whatsoever. That would be the same as writing an application to write an application; a huge detour, and a strange thing to do. you should simply create the script: Copy / ...


1

You can of course use the python or python3 interpreter from the command line, from the python documentation: When invoking Python, you may specify any of these options: python3 [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args] The most common use case is, of course, a simple invocation of a script: python3 myscript.py ...


3

I have a BQ Aquarius E4.5 running Ubuntu 15.04 (r23). It comes with Python 3 (just remember to start "python3" - "python" does not exist and does not symlink to Python 3) so that's a start. I can't see any gcc, cc, or Java on the phone, and no hits on "gcc" or "compiler" or "java" in the Ubuntu Store. If you make the file system read-write you should be ...


2

The following will transpose a matrix with an arbitrary number of rows and columns using near-zero memory resources. #!/bin/sh for i in $(seq 1 $(head -n1 "$1" | wc -c)); do awk -v c=$i 'BEGIN{FS=""}{printf $c}' "$1" echo done Save it with a meaningful name (e.g. transpose.sh), make it executable (chmod +x transpose.sh) and use it like this: ...


2

Two ideas: perl perl -ne ' chomp; $l = length if $. == 1; push @rows, [split //]; } END { for ($i=0; $i<$l; $i++) { for ($j=0; $j<$.; $j++) { print $rows[$j][$i]; } print "\n"; } ' file ruby has a handy Array.transpose method ruby -e 'puts ...


1

I would recommend unsetting PYTHONPATH. It is generally not needed, and it causes things to break like this by making one Python load things from another Python (in this case, it looks like the system's Python 3 is trying to load something that was written for Python 2).


1

Using gawk sudo apt-get install gawk Create a awk script transpose BEGIN { FS = "" } { for (i=1; i<=NF; i++) { a[NR,i] = $i } } NF>p { p = NF } END { for(j=1; j<=p; j++) { str=a[1,j] for(i=2; i<=NR; i++){ str=str""a[i,j]; } print str } } and start with gawk -f transpose ...


1

Perl solution: #!/usr/bin/perl use strict; use warnings; my @arr; while (my $line = <>) { # Read the input line by line. chomp $line; # Remove a newline. # Distribute the characters to subarrays of the array: push @{ $arr[$_] }, substr $line, $_, 1 for 0 .. length($line) - 1; } print @$_, "\n" for ...


0

I had the same error as you. After removing the current non working plugin files, look up "gimp-plugin-registry" in the ubuntu software center. After I installed this the heal selection filter was available and worked.


0

You might find this to be of interest. There is a post there claiming that the RSSI is in the notdecoded part of the packet and they describe how to retrieve it. Also, how you put the card in capture mode may effect the presence of the RSSI info field. I don't think frequency information is stored in the capture, but the type of protection should be in ...


-1

Simple Tutorial Here are the steps I followed to get GAE 1.7.1 working on Ubuntu 12.04. open a terminal Ctr-t and make sure you are in the home directory. create a project folder. (I used google_projects) cd into the project folder download GAE 1.7.1 unzip the file delete the zip. (optional) Here are the terminal commands for the steps above: cd ~ ...


0

Install the libssl-dev package from the repository. Run the following command in the terminal: sudo apt-get install libssl-dev


0

Here is something! I added the export $PYTHONPATH line to my ~/.bashrc , before restarting. All of Anaconda's features work now, although the same Fatal Python error: Py_Initialize: Unable to get the locale encoding error keeps showing up instead of the usual unknown command error, for most miss-typed commands. I will keep looking into this and edit my ...


2

Python 2 and Python 3 have different sets of installed packages. I just installed nltk on both and am able to import in both. pip2 install nltk pip3 install nltk


0

#!/usr/bin/env python from scapy.all import * ap_list = [] def myPacketHandler(pkt) : if pkt.haslayer(Dot11) : #type 0 = Management subtype 4 = Beacon if pkt.type == 0 and pkt.subtype == 8 : if pkt.addr2 not in ap_list : ap_list.append(pkt.addr2) print "AP MAX: %s with SSID: %s" % (pkt.addr2, ...


0

I just realised that I wasn't using scapy as admin (sudo). I run the scapy again with sudo and it worked. Posting the answer to help anyone with similar problem. But I am still not able to find out what to use as filter.


2

Make the following changes to your script: Below line def ResComboB_changed(ResComboB): add the following to it, so it looks like this: def ResComboB_changed(ResComboB): global resolution or add resolution = "" above the def line like this: resolution = "" def ResComboB_changed(ResComboB): Hope that helps ;)


3

You can use python and just python to get the connected monitor names: $ python3 -c 'from gi.repository import Gdk; screen=Gdk.Screen.get_default(); \ [print(screen.get_monitor_plug_name(i)) for i in range(screen.get_n_monitors())]' DP1 LVDS1


3

I am not sure how you are going to apply it in your application ("enable a user to have their desired resolution without requiring graphics drivers" ?), but: A terminal command to list connected screens xrandr | grep " connected " | awk '{ print$1 }' This wil give you the connected screens for further processing, like: VGA-0 DVI-I-1 Since you mention ...


1

In your case run sudo apt-get dist-upgrade instead of sudo apt-get upgrade To see the differences, read the man-page: man apt-get upgrade Used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list(5). Packages currently installed with new versions available are ...


2

When a package is marked as being 'kept back', this means that apt will not auto-update it as it now has a new, extra dependency that you never agreed to install. When you install it specifically with sudo apt-get install python-pip, it returns the message saying that the following packages will be installed to satisfy the dependency requirements: ...


0

The package python-central seems unavailable in Ubuntu 14.04. One may add LinuxMint to their sources - or download the DEB file, e.g., from UbuntuUpdates.org to install via Sotware Center.


0

I use PYTHONPATH: PYTHONPATH=/user_name/pythonEx export PYTHONPATH python -m ex1 CLASSPATH is, as far as I know, a Java path. PATH is a bash path. So, you can also make ex1.py executable, then you can run PATH=/user_name/pythonEx:$PATH ex1.py


1

/usr/bin/ld: cannot find -lsox As mentioned in the first comment, you are missing libsox.


0

After you launched an interpreter as root, it inevitably has root privileges. In order to drop privileges you could write a shell script wrapper where you change the process user and group and start the interpreter without privileges. Solution 1: shell script wrapper You need an unprivileged user which you can switch to (create one with sudo adduser ...


0

Solved the problem (kind of): Did sudo gedit /home/USERNAME/.spyder2/.spyder.ini to look at the file, which basically contains your local spyder preferences/settings. If you know what the erroneous lines are supposed to say, you can simply change them. Since i did not, I simply deleted my entire .spyder2 folder. It was then created anew when i did sudo ...


0

As I see in another post that you consider a ubuntu re-install, then you might try the following: $ dpkg --list | grep -i python > ~/pythonpackages.txt $ ### txt file just to review what was installed $ sudo apt-get purge python* #remove all python related packages $ sudo rm -rf /var/lib/apt/lists #remove apt information $ sudo updatedb ...


0

Probably, you have getting issues to reinstall the python from the apt-get because the tarball instalation has created the files used in python You can download the python package and its dependences, put all the files in the same directory and use dpkg to install overwriting the existent files: To get the requeride package, you can just run apt-get ...


0

Try sudo apt-get install --reinstall python-minimal


1

$ sudo rm /usr/bin/python $ sudo ln -s /usr/bin/python2.7 /usr/bin/python


0

Just stumbled across this and for others who may find the same issue, Ken is correct that the env variables are not being carried over. The solution I used was to add the following lines to my script. This has the added benefit of always loading the virtual environment directly from the script. (Meaning you can use the script with crontab or launchd ...


0

FYI, I fixed this by running: which -a python This gave me 2 different python binaries: /usr/local/bin/python /usr/bin/python where /usr/bin/python was the original. both of these paths were symlinks to python2.7 in the same directories, that is /usr/bin/python was a symlink /usr/bin/python2.7 and so on I simply symlinked the /usr/local/bin/python ...


0

upstart executes commands as root by default. But the user can be specified: How do I start jobs as a non privileged user in Upstart?. But the script was programmed with user specific variables and a dependency to a specific directory. init.py had this line: self.d_root = os.path.join(os.path.expanduser('~'),'Documents','records') I changed it to this ...


0

It appears that since I was running anaconda, the dependencies and packages need to be installed in the virtual environment by itself. Therefore, conda install matplotlib is the solution.


1

If you haven't already, try installing matplotlib through the conda command. The libraries for anaconda are kept separate from the ones installed for python by pip and such. I'd hazard to guess anaconda can't actually find the library. Another possibility may be that its using an incompatible library, in which case uninstall matplotlib and then use conda ...


1

for result in list: result+=result Interpretation: get first/next item in list into result add resultto result and store it in result repeat; get next item in list into result (note: this discards the result on the previous line)


0

Try this: print "Enter Numbers:" list=raw_input().split() list=map(int,list) result = 0 for number in list: result += number print result The result is: python sum_num.py Enter Numbers: 1 2 3 4 5 6 21


1

First install sudo apt-get install python-setuptools Then sudo easy_install simplegui You don't have permission to write to /usr/local/lib/python2.7/dist-packages/test-easy-install-8242.write-test it is owned by root.


0

You can also use: start-stop-daemon -SbCv -x your_command here is init.d script to start and stop a program in the background.


1

This should do the job: $ tar -xzvf foo.tar && cd foo $ for i in *; do echo $i |sed -re "s/[A-Za-z0-9]+(.*)/name\1/"; done To do this in Python call: new_str = re.sub('[A-Za-z]+(.*)', r'\name\1', old_str); Here's another: $ for i in *; do echo name.${i#*.}; done



Top 50 recent answers are included