On Linux, I can use printenv to print shell environment variables.
However, when I search on Nix binary cache for printenv I get No packages found.
Is there a way to get that package via Nixpks?
printenv will be available if you install coreutils from Nixpkgs.
Related
I am new to Linux Subsystem. I am trying to use a package in miniconda. Now after installing miniconda in order for it to work you need add the path like this:
export PATH=~/miniconda/bin:$PATH
I do this and the conda works. I exit the terminal and when I come back and look at my $PATH (using echo $PATH) I see is reset and I have to do it again. What should do for it to stick?
Set and export the PATH variable in your .bashrc file
vi ~/.bashrc
When ever we try to run the command pip intall nltk or pip install numpy we get error that pip is not recognized as internal or external command then we add pip to the path. I want to know that what is path and why we add link in path. Any one help please.
From the Linux Information Project:
PATH is an environmental variable in Linux and other Unix-like operating systems that tells the shell which directories to search for executable files (i.e., ready-to-run programs) in response to commands issued by a user. It increases both the convenience and the safety of such operating systems and is widely considered to be the single most important environmental variable.
So basically it's a list of directories in which the shell looks to find commands.
Let's say your pip is installed at /usr/local/bin/pip, and /usr/local/bin/ is not in your PATH variable, the shell won't be able to find pip.
If you're using Python virtual environment, like python3 -m venv my-venv, you usually have to source bin/activate under my-venv, which adds all scripts under my-venv/bin to your PATH variable for the current shell. Then your shell will be able to find the virtual environment-specific scripts.
Since PATH is set by the login shell, when you close the current shell and open a new one, the variable gets reset. Then you have to call source bin/activate under my-venv again to get shell look into your virtual environment.
I am trying to do "unset" of an env variable from my rpm.spec file. which is not happening
Note that i am not exporting that env inside my rpm.spec.(i will do an export my self in cmd line)
$export user=akshatha
$export group=akshatha1
rpm.spec:
%postun
unset user
unset group
uninstalling the package:
$rpm -e (rpm_package)
check whether the value is unset or not(which is not unset):
$ echo $user
akshatha
$echo $group
akshatha1
You are mixing up what an rpm package is and what it can do.
Environment variables are set within a (bash, shell,...) Session. When you set variables and you start a new session, these variables are gone.
Rpm packages are supposed to install files at certain locations, to make permanent, system wide changes (like installing software). An rpm package, nor the installation of an rpm package is linked to your bash session (the installation will run in a separate session by the way).
You should not try to influence your environment variables with your rpm.
In the very unlikely case that you do need to export some kind of environment variable, then you should try to make it system wide available, for example declaring it in /etc/bashrc or something similar.
I have monkeyrunner set up and am trying to set up AndroidViewClient as well. I followed the tutorial at https://github.com/dtmilano/AndroidViewClient/wiki, doing a pip install, and added the env path to my bash profile using the code:
export ANDROID_VIEW_CLIENT_HOME=/Users/me/Library/Android/sdk/tools/bin/AndroidViewClient-master
I made sure to re-source my bash. However, when I run python check-import.py --debug from the /examples folder, I receive the error:
File "check-import.py", line 22
print("WARNING: '%s' is not a directory and is pointed by ANDROID_VIEW_CLIENT_HOME environment variable" % avcd, file=sys.stderr)
^
SyntaxError: invalid syntax
I'm not very familiar with environmental variables so I could have easily made a mistake that I didn't catch.
If you installed androidviewclient via pip like
pip install androidviewclient
and it didn't give you any errors, then androidviewclient should be installed and available to your scripts via import or command line via its commands (i.e. dump, culebra).
You don't need any environment variables.
Then when you run
./check-import.py --debug
you will see your python path printed and then
OK
It seems you have changed this line https://github.com/dtmilano/AndroidViewClient/blob/master/examples/check-import.py#L22
AndroidViewClient/culebra requires python 2.7.x, so if you have a different version on your system you can install https://github.com/pyenv/pyenv or other virtual environment.
I installed luarocks on centos7, then I execute 'luarocks install luacheck', there is an error:
'Error: Your user does not have write permissions in /usr/local/lib/luarocks/rocks
-- you may want to run as a privileged user or use your local tree with --local.'
So, I execute 'sudo luarocks install luacheck', but there is also an error:
'sudo luarocks command not found'.
I confirm that luarocks has installed correctly, bucause when I execte 'luarocks --version' shows:
/usr/bin/luarocks 2.4.2
As luarocks isn't installed using the native package manager its installed to /usr/local/bin. This isn't in the PATH variable available in the sudo context - you can see (and edit) the configured paths in the secure_path property in the sudoers file.
Workaround that I use it to add a symbolic link to a path included in the secure_path property: sudo ln -s /usr/local/bin/luarocks /usr/bin/luarocks
You can either use
sudo /usr/bin/luarocks install luacheck
to install luacheck system-wide
or
luarocks --local install luacheck
to install to your user only. To use the second option, you also need to run
eval $(luarocks path --bin)
to make sure that the Lua paths are updated in your shell. To make these Lua paths permanent, you can add the above line to your shell config file (~/.bash_profile or similar).