Different command behaviour between SERIAL and SSH
I am trying to establish a python virtual environment with Linux board (NanoPi Duo2 with Ubuntu 16).
However, when I use SSH, wrapper functions (mkvirtualenv, workon) cannot be found while using SERIAL, it can.
I have tried system reboot and "source ~/.profile"
The below is ~/.profile
# virtualenv and virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh
The following is the actual output from same board connected differently.
email@example.com:~$ mkvirtualenv npi bash: mkvirtualenv: command not found
pi@NPi-01:~$ mkvirtualenv npi New python executable in /home/pi/.virtualenvs/npi/bin/python Installing setuptools, pip, wheel... done.
Why would it only work in serial connection?
See also questions close to this topic
Trying to engineer new columns using a for loop to create column names and then populate new columns with data from the dataset
I am working with the olympic medal dataset which can be found here. The data shows aggregated medals won by each country for both summer and winter olympics.
I am trying to create new columns to show the number of gold, silver and bronze medals won per games appearance for summer games, winter games, and combined. I have tried creating a list of medals and seasons medals per game, creating a new column in the dataframe for each combination and thought I could divide the original columns (eg summer gold, summer silver ...) by the total for games attended for given season (eg summer gold / summer games attended).
However, when I tried the code below I got KeyError: ('%s games attended', 'Summer'). Any suggestion for how to accomplish the new feature I'm trying to create would be appreciated
import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv('/Users/xx/Downloads/olympics.txt', header = 1) data.columns = ['Country', 'Summer games attended', 'Summer gold', 'Summer silver','Summer bronze','Summer total', 'Winiter games attended','Winter gold', 'Winter silver','Winter bronze','Winter total', 'Combined games attended','Combined gold', 'Combined silver','Combined bronze','Combined total'] data['Country'] = data['Country'].str.split("\[", expand=True) data.drop(146, axis = 0, inplace = True) medals = ['gold', 'silver', 'bronze'] seasons = ['Summer', 'Winter', 'Combined'] for col in data.columns: for medal in medals: if medal in col: for season in seasons: if season in col: n = season + ' ' + medal + ' per games' data[n] = [i for i in col / 2]
How to implement the iterative way to change the filename reading and how to combine result into single excel file
I am new to python. Have a task that have to find some of the following for all the excel files(1.xlsx-350.xlsx) around 350 excel files, which contained in single folder(Videos). and written following code it works fine but it is time consuming, manually have to change file name every iteration. even in the end of the process, I have to combine all 350 excel file operated data into single excel file. But in my code it overwrite each and every iteration. please help me to resolve this problem.
data12 = pd.read_excel (r'C:\Users\Videos\1.xlsx') gxt = data12.iloc [:,0] gyan = data12.iloc [:,1] int= gyan.iloc[98:197] comp= gyan.iloc[197:252] seg= gyan.iloc[252:319] A= max(int) B= max(comp) C= min(comp) D= max(seg) s = pd.Series([A, B, C, D]) frame_data= [gyan, comp, seg, stat] result = pd.concat(frame_data) result.to_excel("output.xlsx", sheet_name='modify_data', index=False)
thank you for helping.
Tkinter class and methods
I have this tkinter codes, working fine but I want to put them into a class with methods for each process. I am very new to Python, how can I do this?
You don't have to do all, just the class and two methods will be fine and I can learn to replicate the rest.
root= tk.Tk() canvas1 = tk.Canvas(root, width = 400, height = 400, relief = 'raised') canvas1.pack() label1 = tk.Label(root, text='EDA') label1.config(font=('helvetica', 12)) canvas1.create_window(200, 25, window=label1) label2 = tk.Label(root, text='Number of Clusters:') label2.config(font=('helvetica', 8)) canvas1.create_window(200, 120, window=label2) entry1 = tk.Entry (root) canvas1.create_window(200, 140, window=entry1) browseButtonExcel = tk.Button(text=" Import Excel File (CSV) ", command=App.getExcel, bg='green', fg='white', font=('helvetica', 10, 'bold')) canvas1.create_window(200, 70, window=browseButtonExcel) processButton = tk.Button(text=' k-Means Clustering', command=cluster, bg='brown', fg='white', font=('helvetica', 10, 'bold')) canvas1.create_window(200, 170, window=processButton) root.mainloop()
How to compile and run both at the same time for a c++ code in linux terminal?
I am using Ubuntu(latest). If I have a
test.cppfile in my home directory, I write two commands in terminal to compile and run this file.
prateek332@pp-pc:~$ g++ test.cpp prateek332@pp-pc:~$ ./a.out
Is there a way to write these two command simultaneously (or maybe even a better way). I used pipelining but it doesn't work.
prateek332@pp-pc:~$ g++ test.cpp | ./a.out
This doesn't work. It doesn't compile to new changes in
test.cppfile, instead just runs the old code in file.
How are images shown in the terminal
Some packages like w3m-img, fim, lsix etc can be used to show the images directly on the terminal itself on linux.
I am not talking about converting the image into an ASCII character version and showing it but the image itself which looks proper without any the artifacts.
so how do these programs actually draw the images onto the terminal?
Bash, how can I archive every file?
how can I archive every file? What should I add to the command below?
tar cf - /home/django/ | (cd /tmp/ ; tar xvf -)
How to downgrade python version from 3.8 to 3.7 (mac)
I'm using Python & okta-aws tools and in order to fetch correct credentials on aws I need to run okta-aws init. But got an error message of
Could not read roles from Oktaand the system prompted that
"Your Pipfile requires python_version 3.7, but you are using 3.8.3 (/usr/local/Cellar/o/1.1.4/l/.venv/bin/python).
I've tried to search all the Pipfiles on the mac and it seems that the Pipflie under my
/usr/local/Cellarfirstname.lastname@example.org/3.8.3_2/libexec/bin/Pipfileall have the same python version of 3.8, while the Pipfile under my
required python_version = 3.7.
I've been struggling with this for a while and really not sure how I can fix this.
virtualenv choosing python version gives permission denied error
I would like to specify the python version of the virtualenv. I have installed python
3.8through home brew and I can create virtual environments like it is described here like so for both versions:
virtualenv --python=/usr/bin/python2.7 my-env
To now use other python versions e.g.
3.7many pages recommend
pyenv. I can install a specific python version using
pyenvhowever when I want to use it in a similar fashion:
virtualenv --python=/Users/user/.pyenv/versions/3.7.7 my-env
RuntimeError: failed to query /Users/user/.pyenv/versions/3.7.7 with code 13 err: 'Permission denied'
I also tried to activate the
pyenvenvironment globally and use that to install. I can successfully change my python version in the terminal using
pyenv. However after creating the virtual environment it always uses the true python installed and not the one from
Why do I get a permission denied for something that is installed in my home folder? I never used sudo to install any of these things explicitly. How can I solve this?
Python 3.8 virtual environment not finding pip packages
I have this folder that is one of my python projects, inside that folder is my project files, along with two folders. One folder is the python virtual environment for my Windows 10 PC, and the other is another virtual environment for my MacBook. I switch between the two a lot so I wanted to run my python project within VSCode itself for convince.
They both are using the same version of python. My Windows 10 virtual environment works just like it should and my macOS version works, but cannot find the packages that I install within it. (I get an error that the 'packages' module couldn't be found) I've tried installing the packages within the virtual environment itself after I've activated it, I've also install the packages local to my macOS.
When I do a
pip listfrom within the virtual environment, I get this:
So that above shows that, indeed, I do have the request module installed, yet I still get this error:
When I do the command
which python, I get the correct version I was expecting. It's Python 3.8.3 located within my environment folder:
I've done everything the same as I did with my Windows version, so I don't see that I've done anything wrong?
virtualenvwrapper Error: The path python2 (from --python=python2) does not exist
I am trying to set up virtualenv with virtualenvwrapper on Ubuntuo 18.04, but when I try to run
mkvirtualenv tempI get an error from virtualenvwrapper:
The path python2 (from --python=python2) does not exist.
The relevant lines from .bashrc are:
147 # virtualenvwrapper variables 148 export WORKON_HOME=~/.virtualenvs 149 export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 150 export VIRTUALENVWRAPPER_VIRTUALENV=/usr/bin/virtualenv 151 source /usr/local/bin/virtualenvwrapper.sh
If I run
mkvirtualenv temp --python=python3, the environment is created as expected and works fine but I get the message
Already using interpreter /usr/bin/python3which tells me that .bashrc line 149 is correctly setting the variable.
The confusion I have is that I don't use Python2. I know that it is installed on the OS but is the default version for virtualenvwrapper Python 2.x? Even if it was I believe that lines 149 and 150 in .bashrc override this. Any suggestions are appreciated.
python mkvirtualenv ptest generates system cannot find the path specified in windows 10 cmd command
In windows 10 cmd, I have the folder:
C:\Windows\System32\config\systemprofile\Envs- I did not create this folder manually
I manually created the folder:
This Envs has subfolder ptest:
In cmd under
Package Version --------------------- ------- astroid 2.4.2 colorama 0.4.3 isort 4.3.21 lazy-object-proxy 1.4.3 mccabe 0.6.1 pip 20.1 pipdeptree 0.13.2 pylint 2.5.3 setuptools 40.8.0 six 1.15.0 toml 0.10.1 typed-ast 1.4.1 virtualenv 16.7.4 virtualenv-clone 0.5.4 virtualenvwrapper-win 1.2.6 wrapt 1.12.1
- In cmd under
workon ptestand I get:
virtualenv "ptest" does not exit. Create it with "mkvirtualenv"
- In cmd under
lsvirtualenvand I get:
dir /b /ad "C:\WINDOWS\system32\config\systemprofile\Envs"
- In cmd under
where pythonand I get:
- In cmd under
mkvirtualenv ptestI get the message:
The system cannot find the path specified: C:\Windows\System32\config\systemprofile\Envs
- In cmd under
activateand I get:
- In cmd under
(ptest) C:\Users\Username\Envs\ptest\Scripts, type:
pip listand I get:
Package Version ---------------------- ------- dnspython 1.16.0 mysql-connector-python 8.0.19 pip 20.1 protobuf 3.6.1 selenium 3.141.0 setuptools 46.1.3 six 1.14.0 urllib3 1.25.9 wheel 0.34.2
- In Environment variables, I have variable (under System Variables):
WORKON_HOME with path:
Why do I get the error:
The system cannot find the path specified: C:\Windows\System32\config\systemprofile\Envs when trying to create mkvirtualenv ptest
File not found error for virtualenvwrapper configuration on MX-Linux
I'm studying trough Test-driven Development with Python and having some problems to configure virtualenvwrapper. Following the virtualenvwrapper installation instructions, I've added these lines to my .bashrc file:
export WORKON_HOME=$HOME/.virtualenvs export PROJECT_HOME=$HOME/Development source ~/.local/bin/virtualenvwrapper.sh
But after entering
source .bashrcit throws up a not found file or directory error for
/usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh. This file is on ~/.local/bin directory and I don't know why this is happening. So I'm stuck here and didn't continue following the instructions. I don't want an error message every time I open my terminal. If someone can give me a tip here I appreciate.
EDIT: Installed via
pip install. I've set
~/.local/bin/virtualenvwrapper_lazy.shlike the installation page says but still. I can create a venv thought.
NanoPI NEO Air microSD card as a file storage
I have a nanoPI NEO air microcomputer with 8 Gb eMMC memory onboard. I have install friendlyarm linux in the onboard memory. NanoPi also have microSD card slot.
I want to use microSD card as a file storage, but my friendlyarm don't see it.
I don't know where it should be displayed.
I was searching in:
fdisk -l- nothing, except onboard memory. After pull out\insert the card nothing have changed.
/sys/class/mmc_host/mmc- nothing, except onboard memory. After pull out\insert the card nothing have changed.
Any one is able to use focus engine of CAM1320 camera on linux ubuntu
there is any one able to use/control focus mechanism of cam1320 on linux ubuntu?
OR any other friendlyarm camera?
Nanopi M4V2 UART debugging
I have a SBC Nanopi M4V2 (the board link is given below so as to read the specification). I want to use the UART port to debug/console to check what is wrong and why my board is not booting from micro SD. I am new to SBC after searching through internet I understood I need to debug using UART in the board. Hence I intend to buy a TTL to USB serial adapter. After search I got confused as there are many varieties. I am giving the link below can any one answer the below questions
1)Which variety will work with Nanopi M4V2 to debug during booting
2)What are main difference of each TTL to USB cable given in link 3(below)
link 1:- Nanopi M4V2 -> https://www.friendlyarm.com/index.php?route=product/product&product_id=268
link 2:- Nanopi M4V2 hardware spec -> http://wiki.friendlyarm.com/wiki/index.php/NanoPi_M4V2#Hardware_Spec
Link 2:- TTL to USb -> https://www.aliexpress.com/item/4000120687489.html?spm=a2g0s.90423126.96.36.199604c4dZP0BDG